[datatable-help] creating levels for a variable
el_alisio
malnamalja at gmx.de
Mon Dec 28 12:27:38 CET 2015
Hi Carl,
you may want to check out the cut-function:
library("data.table")
dt <- data.table(a = 1:10, b = sample(c(200:50000), 10), c = 21:30)
dt[, level := cut(b, breaks = c(0, 12000, 34000, max(b)),
labels = c("first", "second", "third"))]
Cheers,
Jannes
--
View this message in context: http://r.789695.n4.nabble.com/creating-levels-for-a-variable-tp4715934p4715955.html
Sent from the datatable-help mailing list archive at Nabble.com.
More information about the datatable-help
mailing list