How to name variables on the fly?

前端 未结 6 1586
执念已碎
执念已碎 2020-11-22 10:11

Is it possible to create new variable names on the fly?

I\'d like to read data frames from a list into new variables with numbers at the end. Something like orca1, o

6条回答
  •  孤街浪徒
    2020-11-22 10:24

    And this option?

    list_name<-list()
    for(i in 1:100){
        paste("orca",i,sep="")->list_name[[i]]
    }
    

    It works perfectly. In the example you put, first line is missing, and then gives you the error message.

提交回复
热议问题