On 02/09/2021 3:20 p.m., Greg Minshall wrote:
Andrew,x[] <- lapply(x, function(xx) { xx[is.nan(xx)] <- NA_real_ xx }) is different from x <- lapply(x, function(xx) { xx[is.nan(xx)] <- NA_real_ xx })indeed, the two are different -- but some ignorance of mine is exposed. i wonder, can you explain why the two are different?
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 ______________________________________________ [email protected] mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

