list data.tables in memory and combine by row (rbind)

前端 未结 1 2027
迷失自我
迷失自我 2021-01-22 01:29

I have many data.tables in memory with names following a specific pattern (e.g.: RE_1, RE_2... CO_1, CO_2...). I want to bind them efficiently to get only two data.tables (RE an

1条回答
  •  一整个雨季
    2021-01-22 02:19

    Try

    rbindlist(lapply(ls(pattern = "RE"),get))
    

    Dont know if this is the most effective way but... It works.

    ls(...) returns a vector with the names of your data.tables. Not the data.tables themself. get gets you the object by name.

    You can also use

    rbindlist(mget(ls(pattern = "RE")))
    

    0 讨论(0)
提交回复
热议问题