add_rows: Add rows to data.frame/matrix/table

View source: R/add_rows.R

add_rowsR Documentation

Add rows to data.frame/matrix/table

Description

Take a sequence of vector, matrix or data-frame arguments and combine by rows. Contrary to rbind it handles non-matching column names. There is also special method for the results of cro/cro_fun/tables/fre.

Usage

add_rows(...)

## S3 method for class 'data.frame'
add_rows(..., nomatch_columns = c("add", "drop", "stop"))

Arguments

...

data.frame/matrix/table for binding

nomatch_columns

action if there are non-matching columns between data.frames. Possible values are "add", "drop", "stop". "add" will combine all columns, "drop" will leave only common columns, "stop" will raise an error.

Value

See rbind, cro, cro_fun, fre, tables

Examples

a = data.frame(x = 1:5, y = 6:10)
b = data.frame(y = 6:10, z = 11:15)

add_rows(a, b) # x, y, z

add_rows(a, b, nomatch_columns = "drop")  # y


expss documentation built on Nov. 10, 2022, 6:14 p.m.