Add elements to list (list) through loop in R

x2 <- list()

n <- 1
for(i in 1:10)
{
  x2[[i]] <- n
  n <- n + 1
}

reference:

R language list loop to add elements banlucainiao's blog - CSDN Blog

 

 

Guess you like

Origin blog.csdn.net/u011375991/article/details/131850277