expand_columns: Expand Columns

Description Usage Arguments Details Value Examples

View source: R/expand_columns.R

Description

Row-binds to dataset while insuring column match.

Usage

1

Arguments

x, y

(data.frame)

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.

Value

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
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                |

FCACollin/ClinAD documentation built on Feb. 1, 2021, 12:22 a.m.