toBindLists: Binding lists

View source: R/ToBindLists.R

toBindListsR Documentation

Binding lists

Description

This function is only used internally to bind vectors, data frames, and lists.

Usage

toBindLists(x, y)

Arguments

x

A vector, data frame or list.

y

Object of the same type as x.

Value

It returns a vector, a data frame or a list depending on x.

Author(s)

Clara Anton Fernandez caf@nibio.no

Examples

## Example of how toBindLists works with data frames
x <- data.frame(1:10, ncol = 2)
names(x) <- c('a', 'b')
y <- data.frame(1:20, ncol = 2)
names(y) <- names(x)
j <- toBindLists(x, y)
j

## with vectors
x <- c(1:3)
y <- (8:15)
j <- toBindLists(x, y)
j

## with lists
x <- data.frame(1:10, ncol = 2)
names(x) <- c('a', 'b')
y <- data.frame(1:20, ncol = 2)
names(y) <- names(x)

x <- list(x = x, y = y)

xx <- data.frame(1:10, ncol = 3)
names(xx) <- c('a', 'b')
yy <- data.frame(1:20, ncol = 3)
names(yy) <- names(xx)

y <- list(xx = xx, yy= yy)

j <- toBindLists(x, y)
j

sitree documentation built on April 28, 2022, 5:06 p.m.