Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

glimpse

Get a glimpse of your data


Description

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.

Usage

## 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, ...)

Arguments

x

An object to glimpse at.

width

Width of output: defaults to the setting of the option tibble.width (if finite) or the width of the console.

...

Unused, for extensibility.

object

any R object about which you want to have some information.

Details

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.

Examples

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)

prt

Tabular Data Backed by Partitioned 'fst' Files

v0.1.3
GPL-3
Authors
Nicolas Bennett [aut, cre], Drago Plecko [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.