I'm trying to select one column of an R datatable, without much luck:
test <- data.table(col1 = c("A", "B", "C", "D"), col2 = c(1,2,3,4))
idx <- 1
test[,idx]
The result is [1] 1
instead of what I assume would be the output of test[,1]
.
How come?
Thanks for all help!