R-project filepath from concatenation

后端 未结 1 483
傲寒
傲寒 2020-12-05 21:45

I\'m working through an R tutorial. I\'ve been working on a function and one of the parts of the function is to take an argument and use it to define a directory in which to

1条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-05 22:08

    getmonitor <- function(id, directory=getwd(), ...){
    
      csvfile <- sprintf("%03d.csv", id)
    
      filepath <- file.path(directory, csvfile)
    
      foo <- read.csv(filepath, ...)
    
      foo
    
     }
    

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