fork download
  1. test <- function() {
  2. vec1 <- c(1,2,3)
  3. vec2 <- c(4,5,6)
  4.  
  5. line <- list()
  6. for (i in 1:2) {
  7. line$i <- lm(vec2 ~ vec1)
  8. names(line)[i] <- paste0("reg", i)
  9. }
  10. # return(line)
  11.  
  12. coef <- list()
  13. for (i in 1:2) {
  14.  
  15. coef$i <- line[i]$coefficient[[1]]
  16. return(coef$i)
  17. names(coef)[i] <- paste0("coe", i)
  18. }
  19. return(coef)
  20. }
  21.  
  22. test()
Success #stdin #stdout 0.16s 176448KB
stdin
Standard input is empty
stdout
NULL