I need to replace NA
in a data frame, the thing is that the table has many columns (over 5000), so the code:
y[is.na(y)]<-0
takes a lot of time. Is it any other way to do the same faster? With only 200 rows takes more than 3 minutes.
EDIT
The columns are all integers, and are the result of dcast
(from the reshape2
package).
I tried:
z<-data.table(y)
z[is.na(z)]<-0
and it still takes quite a long time.