glimpse_labels: Get a glimpse of your data, including variable labels.

Description Usage Arguments Details Value Examples

Description

This is like a transposed version of print: columns run down the page, and data runs across. This makes it possible to see every column in a data frame. It's a little like str() applied to a data frame but it tries to show you as much data as possible. (And it always shows the underlying data, even when applied to a remote data source.)

Usage

1

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.

labels

Include variable labels in the printout. If 'TRUE' and no variables have the 'label' attribute, labels will be printed as 10 spaces to demonstrate their absence.

Details

This is a modified version of the tibble package's 'glimpse.tbl' S3 method that includes the contents of the 'label' variable attribute, if present (e.g., if you imported a Stata dataset with variable labels using haven::read_stata()).

Value

x original x is (invisibly) returned, allowing glimpse_labels() to be used within a data pipe line.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
 dat1 <- tibble::data_frame(x = 1:20, y = 21:40)
 attributes(dat1[["x"]])$label <- "this is my label"
 glimpse_labels(dat1)
 
 dat2 <- dat1
 attributes(dat2[["x"]])$label <- paste0(rep("my label", 12), collapse = " ")
 glimpse_labels(dat2)
 
 dat3 <- dat1
 attributes(dat3[["x"]])$label <- paste0(rep("my label", 15), collapse = " ")
 glimpse_labels(dat3)

treysp/spillr documentation built on May 31, 2019, 7:52 p.m.