peek {wakefield} | R Documentation |
Data Frame Viewing
Description
Convenience function to view all the columns of the head
of a truncated data.frame
. peek
invisibly returns
x
. This makes its use ideal in a dplyr/magrittr pipeline.
Usage
peek(x, n = 10, width = 10, ...)
Arguments
x |
A |
n |
Number of rows to display. |
width |
The width of the columns to be displayed. |
... |
For internal use. |
Details
By default dplyr does not print all columns of a data frame
(tbl_df
). This makes inspection of data difficult at times,
particularly with text string data. peek
allows the user to see a
truncated head for inspection purposes.
Value
Prints a truncated head but invisibly returns x
.
See Also
Examples
(dat1 <- r_data_frame(100, id, sentence, paragraph))
peek(dat1)
peek(dat1, n = 20)
peek(dat1, width = 40)
library(dplyr)
## Use in a dplyr/magrittr pipeline to view the data (silly example)
par(mfrow = c(2, 2))
r_data_frame(1000, id, sex, pet, employment, eye, sentence, paragraph) %>%
peek %>%
(function(x, ind = 2:5){ invisible(lapply(ind, function(i) pie(table(x[[i]]))))})
## A wider data set example
dat2 <- r_data_theme()
dat2
peek(dat2)
[Package wakefield version 0.3.6 Index]