I have a large dataset that essentially looks like so:
ex <- data.frame(member = c(rep(1234,5)), caseid = c(72,74,78,72,78),