I have a data.table that contains some groups. I operate on each group and some groups return numbers, others return NA. For some reason data.ta
data.table
NA
data.ta
you can also do something like this :
dtb <- data.table(a=1:10) mat <- ifelse(dtb == 9,NA,dtb$a)
The above command will give you matrix but you can change it back to data.table
new.dtb <- data.table(mat) new.dtb a 1: 1 2: 2 3: 3 4: 4 5: 5 6: 6 7: 7 8: 8 9: NA 10: 10
Hope this helps.