A generic and several methods for converting objects into data frames.
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, ...)
An object to be converted into a data frame.
Additional arguments used by methods.
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()
.