Stack and Reshape Datasets After Splitting Concatenated Values

Online data collection tools like Google Forms often export multiple-response questions with data concatenated in cells. The concat.split (cSplit) family of functions splits such data into separate cells. The package also includes functions to stack groups of columns and to reshape wide data, even when the data are "unbalanced"---something which reshape (from base R) does not handle, and which melt and dcast from reshape2 do not easily handle.


splitstackshape

Travis-CI Build Status AppVeyor Build Status Coverage Status

R functions to split concatenated data, stack columns of your datasets, and convert your data into different shapes.

Core Functions

  • cSplit: A core function that collects the functionality of several of the concat.split family of functions.
  • concat.split: A set of functions to split strings where data have been concatenated into a single value, as is common when getting data collected with tools like Google Forms. (cSplit_l to return a list; and cSplit_e to return an "expanded" view of the input data.)
  • Stacked: A function to create a list of stacked sets of variables. Similar to melt from "reshape2", but doesn't put everything into one very long data.frame.
  • Reshape: A function to allow base R's reshape function to work with "unbalanced" datasets.
  • stratified: A function to take random row samples by groups, similar to sample_n and sample_frac from "dplyr".

Utilities

  • getanID: A function for creating a secondary ID when duplicated "id" variables are present.
  • expandRows: "Expands" the rows of a dataset.
  • listCol_l and listCol_w: Unlists (long) or flattens (wide) a column in a data.frame or a data.table stored as a list. Neither is vectorized.

Install

The package is on CRAN. You can install it using:

install.packages("splitstackshape")

To install the V2 beta version, use:

devtools::install_github("mrdwab/splitstackshape", ref = "v2.0")

To install the V1 development version, use:

devtools::install_github("mrdwab/splitstackshape", ref = "v1_development")

Current CRAN version: 1.4.8

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("splitstackshape")

1.4.8.1 by Ananda Mahto, 7 months ago


http://github.com/mrdwab/splitstackshape


Report a bug at http://github.com/mrdwab/splitstackshape/issues


Browse source code at https://github.com/cran/splitstackshape


Authors: Ananda Mahto [aut, cre]


Documentation:   PDF Manual  


GPL-3 license


Imports data.table

Suggests covr, testthat


Imported by EpiSemble, GB5mcPred, GenericML, HGNChelper, OpEnHiMR, PrInDT, pmledecon, rsocialwatcher, sampleVADIR, visvow.

Suggested by cases.


See at CRAN