From the following dataset, I want a count of patient IDs with more than one visit.
pt_id <- c(1,1,1,1,1,2,2,2,3,3,3,3,3,4) visit <- c(2019, 2019, 2019, 2019, 2020, 2019, 2019, 2020, 2019, 2019, 2019, 2019, 2020, 2019) mydata <- data.frame(pt_id, visit) mydata