measure {nc} | R Documentation |
measure
Description
Computes a value to be used as measure.vars argument to
melt.data.table
. NOTE: only works on newer versions of
data.table that include the measure function.
Usage
measure(..., cols)
Arguments
... |
Regular expression pattern list, passed to |
cols |
Character vector, column names to match with regex. |
Details
measure_multiple
is called if there is a capture group
named "column" and measure_single
is called otherwise.
Value
List or vector to use as measure.vars argument to
melt.data.table
.
Author(s)
Toby Hocking <toby.hocking@r-project.org> [aut, cre]
Examples
library(data.table)
iris.dt <- data.table(datasets::iris[c(1,150),])
melt(iris.dt, measure=nc::measure(part =".*", "[.]", dim =".*"))
melt(iris.dt, measure=nc::measure(column=".*", "[.]", dim =".*"))
melt(iris.dt, measure=nc::measure(part =".*", "[.]", column=".*"))
[Package nc version 2024.2.21 Index]