Learn R Programming

dad (version 4.1.6)

as.data.frame.folder: Folder to data frame

Description

Builds a data frame from an object of class folder.

Usage

# S3 method for folder
as.data.frame(x, row.names = NULL, optional = FALSE, ..., group.name = "group")

Value

as.data.frame.folder returns a data frame.

Arguments

x

object of class folder that is a list of data frames with the same column names.

row.names, optional

for consistency with as.data.frame. as.data.frame.folder does not take them into account.

...

further arguments passed to or from other methods.

group.name

the name of the grouping variable. It is the name of the last column of the returned data frame.

Author

Rachid Boumaza, Pierre Santagostini, Smail Yousfi, Gilles Hunault, Sabine Demotes-Mainard

Details

The data frame is simply obtained by row binding the data frames of the folder and adding a factor (as last column). The name of this column is given by group.name argument. The levels of this factor are the names of the elements of the folder.

See Also

folder: object of class folder. as.folder.data.frame: build an object of class folder from a data frame.

Examples

Run this code
data(iris)

iris.fold <- as.folder(iris, "Species")
print(iris.fold)

iris.df <- as.data.frame(iris.fold)
print(iris.df)

Run the code above in your browser using DataLab