Learn R Programming

⚠️There's a newer version (1.4.8) of this package.Take me there.

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.
  • cSplit_f: A fast way to split columns of data where you know each row would result in the same number of values after being split.
  • 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 development version, use:

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

Current version: 1.4.4

Copy Link

Version

Install

install.packages('splitstackshape')

Monthly Downloads

6,710

Version

1.4.4

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Ananda Mahto

Last Published

March 29th, 2018

Functions in splitstackshape (1.4.4)

FacsToChars

Convert All Factor Columns to Character Columns
NoSep

Split Basic Alphanumeric Strings Which Have No Separators
Names

Dataset Names as a Character Vector, Always
Reshape

Reshape Wide Data Into a Semi-long Form
concat.split

Split Concatenated Cells in a Dataset
concat.split.compact

Split Concatenated Cells into a Condensed Format
expandRows

Expand the Rows of a Dataset
Stacked

Stack Columns from a Wide Form to a Long Form
cSplit

Split Concatenated Values into Separate Values
getanID

Add an "id" Variable to a Dataset
read.concat

Read Concatenated Character Vectors Into a data.frame
cSplit_f

Split Concatenated Cells in a data.frame or a data.table
othernames

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

Split Concatenated Cells and Optionally Reshape the Output
concat.test

Example Dataset with Concatenated Cells
charMat

Create a Binary Matrix from a List of Character Values
splitstackshape-package

splitstackshape
concat.split.list

Split Concatenated Cells into a List Format
listCol_l

Unlist a Column Stored as a List
stratified

Take a Stratified Sample From a Dataset
listCol_w

Flatten a Column Stored as a List
numMat

Create a Numeric Matrix from a List of Values
concat.split.expanded

Split Concatenated Values into their Corresponding Column Position
merged.stack

Take a List of Stacked data.tables and Merge Them