recast: Recast: melt and cast in a single step

Description Usage Arguments See Also Examples

Description

This conveniently wraps melting and (d)casting a data frame into a single step.

Usage

1
recast(data, formula, ..., id.var, measure.var)

Arguments

data

data set to melt

formula

casting formula, see dcast for specifics

...

other arguments passed to dcast

id.var

identifying variables. If blank, will use all non measure.var variables

measure.var

measured variables. If blank, will use all non id.var variables

See Also

http://had.co.nz/reshape/

Examples

1
recast(french_fries, time ~ variable, id.var = 1:4)

Example output

Aggregation function missing: defaulting to length
   time potato buttery grassy rancid painty
1     1     72      72     72     72     72
2     2     72      72     72     72     72
3     3     72      72     72     72     72
4     4     72      72     72     72     72
5     5     72      72     72     72     72
6     6     72      72     72     72     72
7     7     72      72     72     72     72
8     8     72      72     72     72     72
9     9     60      60     60     60     60
10   10     60      60     60     60     60

reshape2 documentation built on May 2, 2019, 5:10 a.m.