variable file names for read.csv in R

后端 未结 2 2136
梦毁少年i
梦毁少年i 2021-01-25 04:06

This may be a very common problem, so I am specifically looking for an elegant or at least less-kludgy-than-mine solution.

I have series of files from 001.csv to 200.csv

2条回答
  •  南笙
    南笙 (楼主)
    2021-01-25 04:26

    A combination of formatC() and paste0() should work:

    paste0(formatC(1:200, width = 3, format = "d", flag = 0), ".csv")
    

提交回复
热议问题