merge_aux_info_from_df: Get auxiliary information from a dataframe, and merge as JSON...

Description Usage Arguments Examples

View source: R/json-helper.R

Description

Get auxiliary information from a dataframe, and merge as JSON strings into master dataframe

Usage

1
2
3
4
5
6
7
8
merge_aux_info_from_df(
  master_df,
  aux_df,
  aux_info_colname,
  by.x,
  by.y,
  verbose_merge = FALSE
)

Arguments

master_df

Dataframe containing master merge information (e.g. names of individuals)

aux_df

Dataframe containing auxiliary information

aux_info_colname

Column name in which to store auxiliary information as JSON objects

by.x

Merge key on master dataframe

by.y

Merge key on auxiliary dataframe

verbose_merge

boolean flag to print output while merging

Examples

1
2
3
4
5
6
7
8
9
individual_df = data.frame(name = c('Alex', 'Bob'), age = c(44, 33), stringsAsFactors = FALSE)
visit_df = data.frame(individual = c('Alex', 'Alex', 'Bob'),
                    visit_num = c(1, 2, 1), 
                    reason = c('Baseline', 'Relapse', 'Baseline'),
                    temperature = c(99.5, 97.9, 99.2))
merge_aux_info_from_df(master_df = individual_df, 
                       aux_df = visit_df, 
                       aux_info_colname = 'visits__JSON', 
                       by.x = 'name', by.y = 'individual')

Paradigm4/revealgenomics documentation built on April 7, 2020, 2:01 a.m.