make_df: Convert to a data frame

View source: R/vector2df.R

make_dfR Documentation

Convert to a data frame

Description

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

Usage

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 Nov. 5, 2023, 9:06 a.m.