for loop in R variable embedded in string name -


i new r , having trouble creating loop in can use variable in string name. example:

lm1 <- lm(a~b+c) lm2 <- lm(a~b+d) lm3 <- lm(a~b+e)  for(i in 1:3){   summary(lm${i}) } 

any appreciated!

work in list.

to models in list

model_list <- mget(paste0('lm',1:3), envir = parent.frame()) # apply summary on each element of list lapply(model_list, summary) 

Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -