I am trying to use lme() function for a repeated measure regression (outcome is a continuous variable "asdate_regdate"). First I posted this question for an error that I received after f1 line. The issue was solved and I faced a new error after lme line.
I have 30 variables and 66872 rows of data. I have both categorical and numerical predictors. I have multiple rows of data per patient. "ikn" is the ID variable for each patient. I replaced missing values in the dataset and I only have few missing data in two of the variables and that's why I used na.action=na.omit. When I run the code I received the following error after lme function.
Error: C stack usage 7969204 is too close to the limit.
my code is as follows:
vars1 <- colnames(d.train)[-c(1,30)]
f1 <- as.formula(paste("asdate_regdate~", paste(vars1, collapse= "*")))
f2 <- as.formula(paste("~1|ikn"))
library(nlme)
model <- lme(f1, random=f2, data=d.train, method="ML", na.action=na.omit)
please find colnames(d.train) as follow:
  [1] "ikn"                                         
  [2] "charlson"                                           
  [3] "sex"                                                
  [4] "age"                                                
  [5] "incquint"                                           
  [6] "rural"                                              
  [7] "death"                                              
  [8] "Tired"                                              
  [9] "Nausea"                                             
 [10] "Depression"                                         
 [11] "Anxious"                                            
 [12] "Drowsy"                                             
 [13] "Appetite"                                           
 [14] "Wellbeing"                                          
 [15] "ShortBreath"                                        
 [16] "Pain"                                               
 [17] "triage"                                             
 [18] "daysInpatient_cihi"                                 
 [19] "hcd_count_in30days"                                 
 [20] "hcd_count_before30days"                             
 [21] "hcd_nursing"                                        
 [22] "hcd_personal"                                       
 [23] "hcd_else"                                                  
 [24] "ohip_count_in30days"                                
 [25] "palliative.care.codes_count_in30days"               
 [26] "house.calls.codes_count_in30days"                   
 [27] "Acodes_count_in30days"                              
 [28] "Wcodes_count_in30days" 
 [29] "cancertype"
 [30] "asdate_regdate"
