Reputation: 8015
I have a data.frame x2
as
> x2
x2
1 NaN
2 0.1
3 NaN
4 0.2
5 0.3
I would like to remove the NaN
from this column. Is there a quick way to do that?
Upvotes: 14
Views: 91063
Reputation: 1960
An easy solution could be:
x2 <- c(NaN, 0.1, NaN, 0.2, 0.3)
library(hablar)
s(x2)
which gives you:
[1] 0.1 0.2 0.3
Upvotes: 2
Reputation: 903
The function subset
could be useful for using complex indicators.
subset(x2, !is.nan(x2[[1]]))
Upvotes: 2