splitstackshape
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 theconcat.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 alist
; andcSplit_e
to return an "expanded" view of the input data.)Stacked
: A function to create a list ofstack
ed sets of variables. Similar tomelt
from "reshape2", but doesn't put everything into one very longdata.frame
.Reshape
: A function to allow base R'sreshape
function to work with "unbalanced" datasets.stratified
: A function to take random row samples by groups, similar tosample_n
andsample_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
andlistCol_w
: Unlists (long) or flattens (wide) a column in adata.frame
or adata.table
stored as alist
. 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