I am struggling with this,
I would like to change this long data frame:
longdf <- data.frame(visitId = c("a", "b", "b", "c"),icd9 = c("441","4424", "443", "441"))
visitId icd9
1 a 441
2 b 4424
3 b 443
4 c 441
To this form,
visitId icd9
1 a c(441)
2 b c(4424,443)
3 c c(441)
So that I can write a grep statement using dplyr on the individual rows. Help would be appreciated.