Learn R Programming

mosaicCore (version 0.9.0)

make_df: Convert to a data frame

Description

A generic and several methods for converting objects into data frames.

Usage

make_df(object, ...)

# S3 method for list make_df(object, ...)

# S3 method for matrix make_df(object, ...)

# S3 method for numeric make_df(object, ...)

# S3 method for default make_df(object, ...)

Arguments

object

An object to be converted into a data frame.

...

Additional arguments used by methods.

Details

These methods are primarily for internal use inside df_stats(), but are exported in case they have other uses. The conversion works as follows. Data frames are left as is. Matrices are converted column-by-column and the columns assembled with as.data.frame(); this allows matrices that are lists to be converted into data frames where columns can have differing types. The names are then set to the column names of object, even if that results in NULL. A numeric vector is converted into a data frame with 1 column. If object is a list, each element is converted using vector2df() and the resulting columns are joined with bind_rows().