| glimpse.prt | R Documentation |
The tibble S3 generic function pillar::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 format_dt(), the function providing the bulk
of functionality, glimpse_dt(), is exported such that implementing a
class specific pillar::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
|
... |
Unused, for extensibility. |
object |
any R object about which you want to have some information. |
Alongside a prt-specific pillar::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 pillar::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 format_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)
pillar::glimpse(cars)
pillar::glimpse(cars, width = 30)
str(cars)
str(cars, vec.len = 1)
str(unclass(cars))
str_sum(cars)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.