Changes to training code
Opened this issue · 1 comments
Hi, someone on my course noticed the code in examples.R for recode should be:
borders %>% mutate(recode(HospitalCode, "B120V" = "B120H"))
rather than:
borders %>%
mutate(HospitalCode = recode("B120V" = "B120H"))
Also I think the joining example should be:
baby_joined <- baby5 %>% left_join(baby6, by = c("FAMILYID" "DOB")
Thanks!
Ciara
Hey!
I think the first suggestion doesn't actually work. The mutate()
function needs to be passed a column name first and passing the recode()
function produces an error.
For the join example, I can see where you're coming from but I think it's easier to read/understand by having the two columns be read into the join function first and not using a pipe, so:
baby_joined <- left_join(baby5, baby6, by = c("FAMILYID", "DOB"))
.
I think if it were a lookup/reference file, your way would make more sense though... happy to take that on and see what you/others think.