Learn R Programming

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

Copy Link

Version

Install

install.packages('splitstackshape')

Monthly Downloads

6,454

Version

1.4.8

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Last Published

April 21st, 2019

Functions in splitstackshape (1.4.8)

numMat

Create a Numeric Matrix from a List of Values
listCol_w

Flatten a Column Stored as a List
expandRows

Expand the Rows of a Dataset
Reshape

Reshape Wide Data Into a Semi-long Form
merged.stack

Take a List of Stacked data.tables and Merge Them
concat.test

Example Dataset with Concatenated Cells
getanID

Add an "id" Variable to a Dataset
othernames

Extract All Names From a Dataset Other Than the Ones Listed
concat.split.multiple

Split Concatenated Cells and Optionally Reshape the Output
stratified

Take a Stratified Sample From a Dataset
concat.split.list

Split Concatenated Cells into a List Format
listCol_l

Unlist a Column Stored as a List
read.concat

Read Concatenated Character Vectors Into a data.frame
splitstackshape-package

splitstackshape
Stacked

Stack Columns from a Wide Form to a Long Form
cSplit

Split Concatenated Values into Separate Values
concat.split.compact

Split Concatenated Cells into a Condensed Format
charMat

Create a Binary Matrix from a List of Character Values
concat.split

Split Concatenated Cells in a Dataset
concat.split.expanded

Split Concatenated Values into their Corresponding Column Position
FacsToChars

Convert All Factor Columns to Character Columns
Names

Dataset Names as a Character Vector, Always
NoSep

Split Basic Alphanumeric Strings Which Have No Separators