Skip to content

Show a dense preview of the DataFrame

Description

The formatting shows one line per column so that wide DataFrames display cleanly. Each line shows the column name, the data type, and the first few values.

Usage

<DataFrame>$glimpse(..., max_items_per_column = 10, max_colname_length = 50)

Arguments

These dots are for future extensions and must be empty.
max_items_per_column Maximum number of items to show per column.
max_colname_length Maximum length of the displayed column names. Values that exceed this value are truncated with a trailing ellipsis.

Value

Returns a character value (invisibly)

Examples

library("polars")

df <- as_polars_df(iris)
df$glimpse()
#> Rows: 150
#> Columns: 5
#> $ Sepal.Length <f64>: 5.1, 4.9, 4.7, 4.6, 5.0, 5.4, 4.6, 5.0, 4.4, 4.9
#> $ Sepal.Width  <f64>: 3.5, 3.0, 3.2, 3.1, 3.6, 3.9, 3.4, 3.4, 2.9, 3.1
#> $ Petal.Length <f64>: 1.4, 1.4, 1.3, 1.5, 1.4, 1.7, 1.4, 1.5, 1.4, 1.5
#> $ Petal.Width  <f64>: 0.2, 0.2, 0.2, 0.2, 0.2, 0.4, 0.3, 0.2, 0.2, 0.1
#> $ Species      <cat>: setosa, setosa, setosa, setosa, setosa, setosa, setosa, setosa, setosa, setosa
df$glimpse(max_items_per_column = 3)
#> Rows: 150
#> Columns: 5
#> $ Sepal.Length <f64>: 5.1, 4.9, 4.7
#> $ Sepal.Width  <f64>: 3.5, 3.0, 3.2
#> $ Petal.Length <f64>: 1.4, 1.4, 1.3
#> $ Petal.Width  <f64>: 0.2, 0.2, 0.2
#> $ Species      <cat>: setosa, setosa, setosa
df$glimpse(max_items_per_column = 3, max_colname_length = 3)
#> Rows: 150
#> Columns: 5
#> $ Se... <f64>: 5.1, 4.9, 4.7
#> $ Se... <f64>: 3.5, 3.0, 3.2
#> $ Pe... <f64>: 1.4, 1.4, 1.3
#> $ Pe... <f64>: 0.2, 0.2, 0.2
#> $ Sp... <cat>: setosa, setosa, setosa