as.data.frame.I(x)
protects all columns in x
, except factors and numerics, using I()
before calling as.data.frame(x)
.as.data.frame.I( x, row.names=NULL, optional=FALSE, ...)
NULL
or a character vector giving the row names for the data frame. Missing values are not allowed.TRUE
, setting row names and converting column names (to syntactic names) is optional.as.data.frame
after protecting columns.data.frame
with the same columns as x
.data.frame
, I
class( as.data.frame( list( x=letters[1:3]))$x) # factor
mode( as.data.frame( list( x=letters[1:3]))$x) # numeric
class( as.data.frame.I( list( x=letters[1:3]))$x) # AsIs
mode( as.data.frame.I( list( x=letters[1:3]))$x) # character
Run the code above in your browser using DataLab