Skip to content

How to globally convert NaN to NA in dataframe?

2 messages · Greg Minshall, Duncan Murdoch

#
Andrew,
indeed, the two are different -- but some ignorance of mine is exposed.
i wonder, can you explain why the two are different?

is it because of (or, "is the clue...") this in the "Value:" section of
: ?"[<-.data.frame"
----
     For '[<-', '[[<-' and '$<-', a data frame.
----
?

cheers, Greg
#
On 02/09/2021 3:20 p.m., Greg Minshall wrote:
x <- lapply(...) says "set x to the list on the RHS", so x becomes a 
list, not a dataframe.

x[] <- lapply(...) says "set the values in x to the values in the list 
on the RHS", so x retains its class.

Duncan Murdoch