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.

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.

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

Current version: 1.4.2

Copy Link

Version

Install

install.packages('splitstackshape')

Monthly Downloads

5,945

Version

1.4.2

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Ananda Mahto

Last Published

October 23rd, 2014

Functions in splitstackshape (1.4.2)

Stacked

Stack Columns from a Wide Form to a Long Form
Reshape

Reshape Wide Data Into a Semi-long Form
listCol_w

Flatten a Column Stored as a List
cSplit

Split Concatenated Values into Separate Values
FacsToChars

Convert All Factor Columns to Character Columns
concat.split.list

Split Concatenated Cells into a List Format
othernames

Extract All Names From a Dataset Other Than the Ones Listed
listCol_l

Unlist a Column Stored as a List
concat.test

Example Dataset with Concatenated Cells
read.concat

Read Concatenated Character Vectors Into a data.frame
charMat

Create a Binary Matrix from a List of Character Values
numMat

Create a Numeric Matrix from a List of Values
merged.stack

Take a List of Stacked data.tables and Merge Them
Names

Dataset Names as a Character Vector, Always
concat.split.expanded

Split Concatenated Values into their Corresponding Column Position
cSplit_f

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

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

Split Concatenated Cells and Optionally Reshape the Output
NoSep

Split Basic Alphanumeric Strings Which Have No Separators
getanID

Add an "id" Variable to a Dataset
splitstackshape-package

splitstackshape
expandRows

Expand the Rows of a Dataset
concat.split.compact

Split Concatenated Cells into a Condensed Format
concat.split

Split Concatenated Cells in a Dataset