@@ -19,8 +19,8 @@ multiple columns simultaneously.
1919\a rguments{
2020\i tem{data}{ A \c ode{data.table} object to melt.}
2121\i tem{id.vars}{vector of id variables. Can be integer (corresponding id
22- column numbers) or character (id column names) vector. If missing, all
23- non-measure columns will be assigned to it. If integer, must be positive; see Details. }
22+ column numbers) or character (id column names) vector, perhaps created using \c ode{patterns()} . If missing, all
23+ non-measure columns will be assigned to it. If integer, must be positive; see Details.}
2424\i tem{measure.vars}{Measure variables for \c ode{melt}ing. Can be missing, vector, list, or pattern-based.
2525
2626 \i temize{
@@ -131,6 +131,7 @@ melt(DT, id.vars=1, measure.vars=c("c_1", "c_2"), na.rm=TRUE) # remove NA
131131# melt "f_1,f_2" and "d_1,d_2" simultaneously, retain ' factor ' attribute
132132# convenient way using internal function patterns()
133133melt(DT, id.vars=1:2, measure.vars=patterns("^f_", "^d_"), value.factor=TRUE)
134+ melt(DT, id.vars=patterns("[in]"), measure.vars=patterns("^f_", "^d_"), value.factor=TRUE)
134135# same as above, but provide list of columns directly by column names or indices
135136melt(DT, id.vars=1:2, measure.vars=list(3:4, c("d_1", "d_2")), value.factor=TRUE)
136137# same as above, but provide names directly:
0 commit comments