knitr::opts_chunk$set( collapse = TRUE, comment = "#>", message = FALSE, warning = FALSE, out.width = "100%" ) library(magrittr)
An R package to play with lists of data.frames.
The purpose of this R package is to transform the names of a list of data.frames into a column of each data.frame. That comes in handy for me in two contexts:
broom
package, tagnfuse
the list and you are good to go.install.packages("devtools") devtools::install_github("ALanguillaume/tagnfuse", dependencies = TRUE)
library(tagnfuse)
Example using dummy data.
foo <- list(bonnie = data.frame(dollars = c(100, 200), bullets = c(3, 4)), clyde = data.frame(dollars = c(150, 75), bullets = c(7, 8))) foo
Tag...
foo %>% tag(label = "gangster")
...and then fuse !
foo %>% tag(label = "gangster") %>% fuse()
Or directly
foo %>% tagnfuse(label = "gangster")
This was an exercice for me to learn R package development. One should not use this package in production code. dplyr::bind_rows()
or data.table::rbindlist()
are the state of the art tools for such operations.
foo %>% dplyr::bind_rows(.id = "gangster")
foo %>% data.table::rbindlist(idcol = "gangster")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.