0

I was wandering about this and finally found an answer I would like to share here: https://groups.google.com/forum/#!topic/h2ostream/M9rIi0k6K08

If you have an H2OFrame like this:

  a   b    c    d    e
1 0   NA   NA   NA   NA
2 0   2    2    2    2
3 0   NA   NA   NA   NA
4 0   NA   NA   1    2
5 0   NA   NA   NA   NA
6 0   1    2    3    2

And would like to replace all NAs in column b with 0s to gain this:

  a   b    c    d    e
1 0   0    NA   NA   NA
2 0   2    2    2    2
3 0   0    NA   NA   NA
4 0   0    NA   1    2
5 0   0    NA   NA   NA
6 0   1    2    3    2

1 Answers1

0

Then this code will do it:

h2o_frame[is.na(h2o_frame$b), "b"] <- 0

All the credits to Spencer Aiello on the H2O Google forum!