I'm trying to remove my NaNs
in a very large list.
Removing NAs
is quite easy with
My.List[!is.na(My.List)]
But using
My.List[!is.nan(My.List)]
is not an implemented method for lists (R-Error).
Can you help me? Thanks!
I'm trying to remove my NaNs
in a very large list.
Removing NAs
is quite easy with
My.List[!is.na(My.List)]
But using
My.List[!is.nan(My.List)]
is not an implemented method for lists (R-Error).
Can you help me? Thanks!
Try
MyList <- na.omit(My.List)
You can use sapply
to find the NaN
s
> x <- list(1, NaN, 3)
>
> x[!sapply(x, is.nan)]
[[1]]
[1] 1
[[2]]
[1] 3