Get a glimpse of your data
The tibble
S3 generic function tibble::glimpse()
is implemented for
prt
objects as well. Inspired by the output of str()
when applied to
data.frames
, this function is intended to display the structure of the
data in terms of columns, irrespective of how the data is organized in terms
of R
objects. Similarly to trunc_dt()
, the function providing the bulk
of functionality, glimpse_dt()
, is exported such that implementing a
class specific tibble::glimpse()
function for other classes that
representing tabular data is straightforward.
## S3 method for class 'prt' glimpse(x, width = NULL, ...) glimpse_dt(x, width = NULL) str_sum(x) ## S3 method for class 'prt' str(object, ...) str_dt(x, ...)
x |
An object to glimpse at. |
width |
Width of output: defaults to the setting of the option
|
... |
Unused, for extensibility. |
object |
any R object about which you want to have some information. |
Alongside a prt
-specific tibble::glimpse()
method, a str()
method is
provided as well for prt
objects. However, breaking with base R
expectations, it is not the structure of the object in terms of R
objects
that is shown, but in the same spirit as tibble::glimpse()
it is the
structure of the data that is printed. How this data is represents with
respect to R
objects is abstracted away as to show output as would be
expected if the data were represented by a data.frame
.
In similar spirit as trunc_dt()
and glimpse_dt()
, a str_dt()
function
is exported which provides the core functionality driving the prt
implementation of str()
. This function requires availability of a
head()
function for any object that is passed and output can be
customized by implementing an optional str_sum()
function.
cars <- as_prt(mtcars) tibble::glimpse(cars) tibble::glimpse(cars, width = 30) str(cars) str(cars, vec.len = 1) str(unclass(cars)) str_sum(cars)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.