I'm struggling with a particular aspect of filtering my data.
I have a table that records about 300 parameters for about 8000 patients over the course of a study. I can already filter for those without baseline readings, but I'm struggling to exclude patients with a low number of readings for a certain variable.
For example, I'm trying to run a simple model which correlates a gastrointestinal score with a range of other variables. What I need to ensure is that patients with zero, or one reading for SCOPAAUT_gastrointestinal are excluded. Has anyone dealt with anything related to this? I can index for patient number, but from there, I'm unsure where to progress.
model1 <- lmer(SCOPAAUT_gastrointestinal~Age_bl + GENDER + EDUCYRS + APPRDX_enrol +
(1 + Years_bl|PATNO), data = datasetfilteredDR)