cbindList: cbind all elements in a list

View source: R/cbindList.R

cbindListR Documentation

cbind all elements in a list

Description

merge a list in which are all data.frame with one common rowname or one common column number

Usage

cbindList(List, ID = 0, replace = NA, sep = ".", fast = FALSE)

Arguments

List

a list of data frame.

ID

The number of column, or the column name that need to be refered. If ID = 0, then the row names of each data frame will be used.

replace

The value to replace the NAs that generated by cbind of data frame.

sep

seperation character of the column names in the data frame and the corresponding list index. The default is sep = ".".

fast

using cbind if the rownames of each element in the List are the same. The default is FALSE.

includeColId

Logical. Include the refered column if it is TRUE

Value

A combined data frame, in which the colnames are the colnames in the original data frame and corresponding list index

Examples

{
## Not run: 
# The zeros/ones matrix
a = data.frame(a = letters[1:5], b = rnorm(5))
b = data.frame(a = letters[3:7], c = rnorm(5))
x = list(a, b)
cbindList(List = x, ID = 1)
cbindList(List = x, ID = 0)
cbindList(List = x, ID = "a")
cbindList(List = x, ID = "a", replace = 0)
cbindList(List = x, ID = "a", replace = 0, sep = "_")

## End(Not run)
}

paodan/funcTools documentation built on April 1, 2024, 12:01 a.m.