read_alex_database_med_log: function used to clear up the medication log data, keep only...

Description Usage Arguments Value Examples

View source: R/get_alexdata.R

Description

function used to clear up the medication log data, keep only the medication in the medList, remove the unused records.

Usage

1
read_alex_database_med_log(dataFrame, medList)

Arguments

dataFrame

the raw medication log data frame contains the data from baseline_antibiotics.csv and medication_log.csv and a column of collect date time

Value

medRaw return a data frame that contains only the medications in the medList

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
medList <- as.list(read.xlsx("/Users/yue/Dropbox/Joy/tabacco_grant/data/data_fromsarah/IBD Medication List_2.17.2017.xls", sheetIndex = 1,stringsAsFactors = F))
medList <- sapply(medList, function(x) x = x[!is.na(x)])
names(medList)[which(names(medList) == "Other")] = "Other.med"
names(medList)[which(names(medList) == "X5.ASA")] = "5.ASA"
alex_medication_log <- read_alex_database(fileName = "/Users/yue/Dropbox/Joy/tabacco_grant/data/data_fromalex/database/database10052017/medication_log.csv")
alex_medication_log %<>% mutate(start_date = as.Date(start_date)) %>%
mutate(stop_date = as.Date(stop_date)) %>%
mutate(duration = stop_date - start_date)
a <- read_alex_database(fileName = "/Users/yue/Dropbox/Joy/tabacco_grant/data/data_fromalex/database/database10052017/sample_redcap.csv") %>%
rename(collect_date_time = Collected_Time)
alex_medication_log %<>% left_join(a, by = c("ehb_id")) %>%
rename(SampleType = Sample.Type)
remove(a)
medRaw = read_alex_database_med_log(dataFrame = alex_medication_log, medList = medList)

reny1/alexdata documentation built on May 29, 2019, 8:06 a.m.