[Rd] Protecting vectors in ?as.data.frame

Steve Martin m@rbert@ @end|ng |rom protonm@||@com
Mon Oct 26 18:14:21 CET 2026


?as.data.frame says the following in Details.

"Character variables are converted to factor columns unless protected by \code{\link{I}}."

It seems like this should be qualified with "if \code{stringsAsFactors} is true", as in ?data.frame.

Similarly, ?data.frame says that

"If a list or data frame or matrix is passed to \code{data.frame} it is as if each component or column had been passed as a separate argument (except for matrices protected by \code{\link{I}})."

This again seems out of date as list columns can be protected with I(). Does it also make sense to note that matrix and list columns can be protected in the analogous part of ?as.data.frame (par. 4 in Details)? I'm not sure about data frames, as these can be protected with I() but may well give an error when printing.

Steve



More information about the R-devel mailing list