Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

parse_formula

Parse casting formulae.


Description

There are a two ways to specify a casting formula: either as a string, or a list of quoted variables. This function converts the former to the latter.

Usage

parse_formula(formula = "...  ~ variable", varnames, value.var = "value")

Arguments

formula

formula to parse

varnames

names of all variables in data

value.var

name of variable containing values

Details

Casting formulas separate dimensions with ~ and variables within a dimension with + or *. . can be used as a placeholder, and ... represents all other variables not otherwise used.

Examples

reshape2:::parse_formula("a + ...", letters[1:6])
reshape2:::parse_formula("a ~ b + d")
reshape2:::parse_formula("a + b ~ c ~ .")

reshape2

Flexibly Reshape Data: A Reboot of the Reshape Package

v1.4.4
MIT + file LICENSE
Authors
Hadley Wickham <h.wickham@gmail.com>
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.