Tabel Data R Pilih beberapa kolom
# library
library(data.table)
# generate random data
data <-
data.table(
'Var1' = sample(-100:100, 5),
'Var2' = sample(-100:100, 5),
'Var3' = sample(-100:100, 5)
)
# option 1: directly through the variable names
data[, .(Var2, Var3)]
# option 2: using .SD & .SDcols
data[, .SD, .SDcols = c('Var2', 'Var3')]
Irgendniemand