I'm really liking this package - thank you! I did come across an error: if you pass the data from the pipe to the y in join(as opposed to x) it throws an error. You can fix it by calling the dplyr version.
# ## merge data sets to include all visits (even those w/o Rx)
analysis <- analysis %>%
left_join(x = patient, y = .) %>%
mutate_at(vars(prescribed_opioid), factor, levels = c(NA, TRUE, FALSE),
labels = c('No Rx', 'Prescribed Opioid', 'Not Prescribed Opioid'),
exclude = NULL)
# Error in log_join(.data, dplyr::left_join, "left_join", ...) :
# argument ".data" is missing, with no default
### Works:
analysis <- analysis %>%
dplyr::left_join(x = patient, y = .) %>%
mutate_at(vars(prescribed_opioid), factor, levels = c(NA, TRUE, FALSE),
labels = c('No Rx', 'Prescribed Opioid', 'Not Prescribed Opioid'),
exclude = NULL)
# Joining, by = "Encounter_id"
### Also works:
analysis <- patient %>%
left_join(analysis) %>%
mutate_at(vars(prescribed_opioid), factor, levels = c(NA, TRUE, FALSE),
labels = c('No Rx', 'Prescribed Opioid', 'Not Prescribed Opioid'),
exclude = NULL)
# Joining, by = "Encounter_id"
# left_join: added 0 rows and added one column (prescribed_opioid)
# mutate_at: converted 'prescribed_opioid' from logical to factor (-101770 new NA)
The later also works but it tells you how many rows you added to patient not analysis.
This is my first public issue and I'm sorry if I've done anything incorrectly.