append_cols_df: Append extra columns to a dataframe

Description Usage Arguments Examples

View source: R/append_cols_df.R

Description

Reads two data frames x, y and based on the user defined key columns key_x, key_y, add the columns described by append_y to the x table.

Usage

1
append_cols_df(x, y, key_x, key_y, append_y)

Arguments

x

Main working data frame. NA will be added in the rows on x that do not match with y.

y

Secondary data frame containing columns to be added in the main one. Columns that do not match with x will be excluded.

key_x

Character string describing key column of the first data frame. You can use partial matching.

key_y

Character string describing key column of the second data frame. You can use partial matching.

append_y

Character vector containing strings that match the columns to be added in the main data frame. You can use also partial matching.

Examples

1
2
3
4
5
6
add_me <- colnames(y)[c(4, 10)]
ap <- append_cols_df(x = k3,
                  y = y,
                  key_x = "Protein A",
                  key_y = "Entry$",
                  append_y = add_me)

tkostas/komics documentation built on May 24, 2019, 7:31 a.m.