Use object names within a list in lapply/ldply

前端 未结 4 1412
攒了一身酷
攒了一身酷 2021-01-12 10:35

In attempting to answer a question earlier, I ran into a problem that seemed like it should be simple, but I couldn\'t figure out.

If I have a list of dataframes:

4条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-12 11:10

    Using base only, one could try something like:

    dd <- lapply(seq_along(df.list), function(x) cbind(df_name = paste0('df',x),df.list[[x]]))
    
    do.call(rbind,dd)
    

提交回复
热议问题