as.data.frame.I {mvbutils}R Documentation

Coerce to data.frame, preserving mode of columns

Description

as.data.frame.I(x) protects all columns in x, except factors and numerics, using I() before calling as.data.frame(x).

Usage

as.data.frame.I( x, row.names=NULL, optional=FALSE, ...)

Arguments

As per as.data.frame.
x a list
row.names NULL or a character vector giving the row names for the data frame. Missing values are not allowed.
optional logical. If TRUE, setting row names and converting column names (to syntactic names) is optional.
... passed to as.data.frame after protecting columns.

Value

A data.frame with the same columns as x.

See Also

data.frame, I

Examples

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

[Package mvbutils version 2.5.0 Index]