zipFastener {QurvE}R Documentation

Combine two dataframes like a zip-fastener

Description

Combine rows or columns of two dataframes in an alternating manner

Usage

zipFastener(df1, df2, along = 2)

Arguments

df1

A first dataframe.

df2

A second dataframe with the same dimensions as df1.

along

1 to alternate rows or 2 to alternate columns.

Value

A dataframe with combined rows (or columns) of df1 and df2.

Author(s)

Mark Heckmann

Examples

# data frames equal dimensions
df1 <- plyr::rdply(3, rep('o',4))[ ,-1]
df2 <- plyr::rdply(3, rep('X',4))[ ,-1]

zipFastener(df1, df2)
zipFastener(df1, df2, 2)
zipFastener(df1, df2, 1)

# data frames unequal in no. of rows
df1 <- plyr::rdply(10, rep('o',4))[ ,-1]
zipFastener(df1, df2, 1)
zipFastener(df2, df1, 1)

# data frames unequal in no. of columns
df2 <- plyr::rdply(10, rep('X',3))[ ,-1]
zipFastener(df1, df2)
zipFastener(df2, df1, 2)


[Package QurvE version 1.1.1 Index]