folderh: Hierarchic folder of n data frames related in pairs by (n-1)...

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/folderh.R

Description

Creates an object of class folderh, that is a list of n>1 data frames whose rows are related by (n-1) keys, each key defining a relation "1 to N" between the two adjacent data frames passed as arguments of the function.

Usage

1
folderh(df1, key1, df2, ..., na.rm = TRUE)

Arguments

df1

data frame (can also be a tibble) with at least two columns. It contains a factor (whose name is given by key1 argument) whose levels are taken exactly once.

key1

character string. The name of the factor of the data frames df1 and df2 which contains the key of the relations "1 to N" between the two datasets.

df2

data frame (or tibble) with at least two columns. It contains a factor column (named by keys argument) with the same levels as df1[, key1] (see Details).

...

optional. One or several supplementary character strings and data frames, ordered as follows: key2, df3, .... The argument key2 indicates the key defining the relation "1 to N" between the data frames df2 and df3, and so on.

na.rm

logical. If TRUE, the rows of each data frame for which the key is NA are removed.

Details

The object of class folderh is a list of n ≥ 2 data frames.

If there are more than two data frames, folderh computes a folderh with the two last data frames, and then uses the function appendtofolderh to append each one of the other data frames to the folderh.

Value

Returns an object of class folderh. Its elements are the data frames passed as arguments, and the attribute attr(, "keys") contains the character arguments.

Author(s)

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

See Also

is.folderh to test if an object is of class folderh. folder for a folder of data frames with no hierarchic relation between them. as.folder.folderh (or as.data.frame.folderh) to build an object of class folder (or a data frame) from an object of class folderh,

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
# First example: rose flowers
data(roseflowers)
df1 <- roseflowers$variety
df2 <- roseflowers$flower
fh1 <- folderh(df1, "rose", df2)
print(fh1)

# Second example
data(roseleaves)
roses <- roseleaves$rose
stems <- roseleaves$stem
leaves <- roseleaves$leaf
leaflets <- roseleaves$leaflet
fh2 <- folderh(roses, "rose", stems, "stem", leaves, "leaf", leaflets)
print(fh2)

dad documentation built on March 16, 2021, 9:05 a.m.