I have a data.table from which I want to remove those rows which have NA value in any column.
a <- data.table(s = c(1, 2, 3, NA, NA, 3, 2), d = c(32, 23, 2, 121, NA, 3, NA))
So to remove NA values from this data.table, I will have to assign it back to a
:-
a <- na.omit(a)
In this way it will create a new object a
in a new memory address.
I want to know if there is a way in which I can use data.table syntax ([i, j, by]
) which can remove the NA values, take care of the assignment and not create a new memory address for a
.