skimr (version 1.0.3)

wide: Working with skimr's printed output

Description

These functions provide two approaches for handling the wide format produced when you print skim_df. skim_to_wide() returns a wide data frame with one row per variable and NA for statistics not calculated for a given type. skim_to_list() creates a list of wide tibbles, one for each type of vector within your data frame.

Usage

skim_to_wide(x, ...)

skim_to_list(x, ...)

Arguments

x

A data frame.

...

Further arguments passed to or from other methods.

Value

A wide data frame or a list of wide data frames.

Details

Note that in both cases, all columns are character vectors. This gives you additional control of the printed output, but not the original data.

Examples

Run this code
# NOT RUN {
# Treat the printed output as a wide data frame
skim_to_wide(iris)
iris %>% skim_to_wide()
iris %>%
  skim_to_wide() %>%
  dplyr::filter(type == "factor") %>% 
  dplyr::select(top_counts)

# Treat the printed output as a list of data frames
skim_to_list(iris)
iris %>% skim_to_list()

# Save the result
sl <- iris %>% skim_to_list() 
sl[["numeric"]]
kable(sl$numeric)

# Or grouped, this uses the magrittr exposition pipe
# see ?magrittr::`%$%`
library(magrittr)
iris %>%
  dplyr::group_by(Species) %>%
  skim_to_list() %$%
  kable(numeric)
# }

Run the code above in your browser using DataCamp Workspace