knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
Loop Verbs For Grammar of Data Manipulation
# install.packages("devtools") devtools::install_github("krzjoa/looplyr")
looplyr
provides easy-to-use shortcuts to apply mutate
/summarise
in loop and
and loop operator to process multiple data.frame-like objects using one dplyr
/magrittr
pipe wrapped with curly brackets.
loop_mutate
suppressMessages(library(dplyr)) suppressMessages(library(glue)) library(looplyr) cars %>% loop_mutate( 2:4, paste0("speed.", .x) := speed ** .x ) %>% head(5)
loop_summarise
quantiles <- c(0.25, 0.50, 0.75) iris %>% group_by(Species) %>% loop_summarise( quantiles, glue("Petal.Length.{.x}") := quantile(Petal.Length, .x), glue("Petal.Width.{.x}") := quantile(Petal.Width, .x) )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.