make_df: Convert to a data frame

Description Usage Arguments Details

View source: R/vector2df.R

Description

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

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
make_df(object, ...)

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

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

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

## Default S3 method:
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().


mosaicCore documentation built on Jan. 16, 2021, 5:32 p.m.