Skip to contents

peek() provides a transposed view of your dataset: columns are displayed vertically, while the data for each column is shown horizontally. This layout allows you to inspect all the columns of a data.frame at a glance. It serves as a convenient wrapper around utils::str(), with the added benefit of invisibly returning the input object, making it suitable for use in data pipelines.

Usage

peek(x, width = getOption("width"), ...)

Arguments

x

The object to be inspected.

width

integer(1). Specifies the maximum width of the output.

...

Additional arguments to pass to utils::str().

Value

The input object x, returned invisibly.

Examples

peek(mtcars)
#> Rows: 32 
#> Columns: 11 
#> -------------------------
#> $ mpg       <dbl> 21, 21, 22.8, 21.4, 18.7, 18.1, 14.3, 24.4, 22.8, 19.2, 17.8, 16.4...
#> $ cyl       <dbl> 6, 6, 4, 6, 8, 6, 8, 4, 4, 6, 6, 8...
#> $ disp      <dbl> 160, 160, 108, 258, 360, 225, 360, 146.7, 140.8, 167.6, 167.6, 275.8...
#> $ hp        <dbl> 110, 110, 93, 110, 175, 105, 245, 62, 95, 123, 123, 180...
#> $ drat      <dbl> 3.9, 3.9, 3.85, 3.08, 3.15, 2.76, 3.21, 3.69, 3.92, 3.92, 3.92, 3.07...
#> $ wt        <dbl> 2.62, 2.875, 2.32, 3.215, 3.44, 3.46, 3.57, 3.19, 3.15, 3.44, 3.44, 4.07...
#> $ qsec      <dbl> 16.46, 17.02, 18.61, 19.44, 17.02, 20.22, 15.84, 20, 22.9, 18.3, 18.9, 17.4...
#> $ vs        <dbl> 0, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 0...
#> $ am        <dbl> 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0...
#> $ gear      <dbl> 4, 4, 4, 3, 3, 3, 3, 4, 4, 4, 4, 3...
#> $ carb      <dbl> 4, 4, 1, 1, 2, 1, 4, 2, 2, 4, 4, 3...