Row-binds to dataset while insuring column match.

expand_columns(x, y)

Arguments

x, y

(data.frame)

Value

A data.frame with the columns from the two datasets.

Details

The columns metadata must follow the column, even when transfered from a dataset to another one. However, while the data.frame format with row number equal to data column number, it is not garranty the two data sets have the same metadata composition. This function, makes sure of the column match between two datasets before row binding.

Examples

t1 <- data.frame( row.names = "STUDYID", label = "Study Identifier", names = "name" ) # | |label |names | # |:-------|:----------------|:-----| # |STUDYID |Study Identifier |name | t2 <- data.frame( row.names = c("SUBJID", "AGE"), names = c("Subject Identifier", "Age") ) # | |names | # |:------|:------------------| # |SUBJID |Subject Identifier | # |AGE |Age | expand_columns(t1, t2)
#> label names #> STUDYID Study Identifier name #> SUBJID <NA> Subject Identifier #> AGE <NA> Age
# | |label |names | # |:-------|:----------------|:------------------| # |STUDYID |Study Identifier |name | # |SUBJID |NA |Subject Identifier | # |AGE |NA |Age |