I have a data.table that resembles the one below.
data.table
tab <- data.table(a = c(NA, 42190, NA), b = c(42190, 42190, NA), c = c(40570, 42190, NA)) tab
There is a faster way to do this than coercing to either matrix or data.frame. Just use the [data.frame function.
[data.frame
`[.data.frame`( tab, cbind(ri,ci) ) [1] NA 42190 NA
This is the functional syntax for the [.data.frame function.
[.data.frame