R- Referencing different dataframes in a loop

后端 未结 3 869
清酒与你
清酒与你 2021-01-27 02:43

I am brand new to R so if I\'m thinking about this completely wrong feel free to tell me. I have a series of imported dataframes on power plants, one of each year (Plant1987, Pl

3条回答
  •  失恋的感觉
    2021-01-27 03:14

    Try this ..

    year=seq(1987,2008,by=1)
    list_object_names = sprintf("Plant%s", 1987:2008)
    
    list_DataFrame = lapply(list_object_names, get)
    
    for (i in 1:length(list_DataFrame ) ){
        list_DataFrame[[i]][,'Year']=year[i]
    }
    

提交回复
热议问题