I have data on longitudinal data and I want to perform a two-stage analysis. As a first step, I need to model linear regression for each subject but the data is unbalanced and some subjects have only one measurement. The 'id' is repeated for a particular individual. How do I remove rows of subjects with only one measurement? Other repeated measurements are y (the outcome variable) and age.
Asked
Active
Viewed 49 times
0
-
It's easier to help you if you include a simple [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input and desired output that can be used to test and verify possible solutions. – MrFlick Oct 28 '20 at 00:07
-
1Sounds as though something like `library(dplyr)` and `yourdata %>% group_by(id) %>% filter(n() > 1)` may be what you want. But we need to see the data. – neilfws Oct 28 '20 at 00:08