measure | R Documentation |
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.
measure(..., cols)
... |
Regular expression pattern list, passed to |
cols |
Character vector, column names to match with regex. |
measure_multiple
is called if there is a capture group
named "column" and measure_single
is called otherwise.
List or vector to use as measure.vars argument to
melt.data.table
.
Toby Dylan Hocking
if("measure" %in% ls(asNamespace("data.table"))){
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=".*"))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.