https://github.com/moodymudskipper/realquick
One line object summaries
https://github.com/moodymudskipper/realquick
Last synced: 25 days ago
JSON representation
One line object summaries
- Host: GitHub
- URL: https://github.com/moodymudskipper/realquick
- Owner: moodymudskipper
- Created: 2023-04-07T11:29:10.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-04-07T11:29:20.000Z (about 2 years ago)
- Last Synced: 2024-11-26T01:46:48.837Z (5 months ago)
- Size: 2.93 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.Rmd
Awesome Lists containing this project
- jimsghstars - moodymudskipper/realquick - One line object summaries (Others)
README
---
output: github_document
---```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```# realquick
A placeholder at the moment.
We want :
* `realquick::describe()` for one line summaries of objects, mentioning type, class, length if relevant, the namespace for a closure, this kind of things.
* The default approach ignores the data content
* An optional approach uses some of the content if we have enough room (as given by a `width` parameter),
for instance it might include factor levels, missing values, function args... We can
set them individually.
* `realquick::compare()` for one line comparison summaries.
* We might use `waldo::compare(,max_diffs = 1)` and trim down the output if necessary, but it's expensive since waldo seems not to return early when `max_diffs` are exceeded, and this package could be made dependency free.
* `realquick::assess(object, predicate, ptype)` describes the object only if predicate is not satisfied,
and the description is limited to what differs from the prototype
* We use S3 methods and provide a mechanism for users to override them (we need this for {constructive} too)Names are simple and meant to be used with the `namespace::notation`, no need to worry about
overriding common names.All these functions return a string with a class that prints nice, so they can easily
be used with `stop()`, `abort()`, `warn()`.We might provide an `action` parameter to these functions to trigger `abort`, `warn`, `inform`,
but our default behavior is low level, so we're not primarily an assertion package.
Action takes a function but we can provide a formula so we can pass additional args to `abort` this way.## Alternatives
`pillar::type_sum()` and `vctrs::vec_ptype_abbr().` provide very short summaries
to be used for column names, what we want is succinct summaries to be used in messages, warnings, errors.Some packages like {skimr} provide summaries, but these are not one liners and generally
too long to be integrated in a message.{waldo} doesn't export anything for short summaries but they do produce them so we might
want to check that code.`constructive:::describe()` is a starting point.