melt.keyed: Melt a Keyed Data Frame

Description Usage Arguments Details Value Author(s) References See Also Examples

Description

Melt an object with class c('keyed','data.frame'). See also melt.data.frame.

Usage

1
2
3
4
5
6
7
8
9
## S3 method for class 'keyed'
melt(
  data, 
  id.vars=key(data), 
  measure.vars, 
  variable_name = "variable", 
  na.rm = FALSE, 
  ...
)

Arguments

data

passed to melt

id.vars

passed to melt

measure.vars

passed to melt

variable_name

passed to melt

na.rm

passed to melt

...

passed to melt

Details

The package reshape declares the S3 generic melt, and declares a data.frame method for it. The keyed method is similar, but returns a keyed object. The key consists of all columns except value.

Value

An object with class c('keyed','data.frame')

Author(s)

Tim Bergsma

References

http://metrumrg.googlecode.com

See Also

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
time <- rep(2,8)
start <- cumsum(time)
start <- as.mTime(as.second(as.hour(start)))
stop <- start + as.second(as.minute(30))
x <- data.frame(
  subj = rep(c('a','b'), each=4),
  period = 1:4,
  start=start,
  stop=stop
)
x <- as.keyed(x, c('subj','period'))
x 
summary(x)
y <- melt(x)
y
summary(y)
cast(y)

metrumrg documentation built on May 2, 2019, 5:55 p.m.