make_df | R Documentation |
A generic and several methods for converting objects into data frames.
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, ...)
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()
.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.