Description Usage Arguments Value Examples
Generalizes functions to work on lists of data
1 | to_map(func)
|
func |
A function |
A function that works on lists of data
1 2 3 4 5 6 7 8 9 10 11 12 13 | ## Not run:
setwd("path/to/datasets/")
list_of_datasets <- list.files(pattern = "*.csv")
list_of_loaded_datasets <- read_list(list_of_datasets, read_func = read.csv)
# To get the summary statistics of all variables for all the datasets in the list:
summarymap <- to_map(summary)
summarymap(list_of_loaded_datasets)
# To get the summary statistics of a single variable for all the datasets in the list:
summarymap(list_of_loaded_datasets, "variable")
# This is equivalent to
purrr::map(list_of_loaded_datasets, (function(x) summary(x$variable)))
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.