initialize: Multi-Header Data Frames

mlth.data.frameR Documentation

Multi-Header Data Frames

Description

Create a multi-header data frame which is an hierarchical collection of variables.

Usage

mlth.data.frame(
  ...,
  row.names = NULL,
  check.rows = FALSE,
  check.names = FALSE,
  fix.empty.names = FALSE
)

mlth(
  ...,
  row.names = NULL,
  check.rows = FALSE,
  check.names = FALSE,
  fix.empty.names = FALSE
)

Arguments

...

the collection of named variables or sub-tables, each of class list. All variables must be of the same length.

row.names

NULL or character or integer vector to be used as row names, must be of the same length as the variables.

stringsAsFactors

same as for data.frame

defaultName

the single character value to fill empty names.

fixNamesSep

the separator which is used when there are more than one empty names.

Details

A mlth.data.frame object is a list of variables and mlth.data.frames. Each variable must be a vector of atomic data type (e.g., POSIX date will not work). Each variable or sub-table must have a name, the names must be unique within the table/sub-table, but not across sub-tables.

Unlike data.frame, a multi-header data frame cannot have zero columns and non-zero rows but can have zero rows and non-zero columns or zero columns and rows.

Value

mlth.data.frame object

Examples

A<-mlth.data.frame(X=c('A','B','C'),
			Y=list(
				N=1:3,
				M=4:6))

## The empty names are filled-in
B<-mlth.data.frame(X=list(rnorm(10),rnorm(10)),
			Y=list(rnorm(10),rnorm(10)),
			row.names=letters[1:10])

## str method for mlth.data.frame
str(B)


IvanVoronin/mlth.data.frame documentation built on Jan. 31, 2024, 10:13 a.m.