knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  message = FALSE,
  warning = FALSE,
  out.width = "100%"
)

library(magrittr)

tagnfuse

An R package to play with lists of data.frames.

Overview

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:

Installation

install.packages("devtools")
devtools::install_github("ALanguillaume/tagnfuse", dependencies = TRUE)

Usage

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")

Statement of purpose

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")


ALanguillaume/tagnfuse documentation built on Feb. 2, 2020, 5:43 p.m.