0

I had the following piece of code which is used for obtaining 4 csv files from a directory called RawData and combining the rows using rbind which works fine

library(data.table)

setwd("C:/Users/Gunathilakel/Desktop/Vera Wrap up Analysis/Vera_Wrapup_Analysis/RawData")  

myMergedData <- 
  do.call(rbind,
          lapply(list.files(path = getwd()), fread))

However, I want to ensure that this code is reproducible in another computer and decided get rid of setwd. So I decided to use the here package and implement the same procedure

library(here)


myMergedData <- 
  do.call(rbind,
          lapply(list.files(path = here("RawData")), fread))

When I run this above script it gives the following message

Taking input= as a system command ('Issued and Referral Charge-2019untildec25th.csv') and a variable has been used in the expression passed to `input=`. Please use fread(cmd=...). There is a security concern if you are creating an app, and the app could have a malicious user, and the app is not running in a secure environment; e.g. the app is running as root. Please read item 5 in the NEWS file for v1.11.6 for more information and for the option to suppress this message. 'Issued' is not recognized as an internal or external command, operable program or batch file.

Nathan123
  • 763
  • 5
  • 18

1 Answers1

0

The list.files call will return the filename Issued and Referral Charge-2019untildec25th.csv without its path. You need

list.files(path = here("RawData"), full.names = TRUE)

so that you get the path as well, and fread will be able to find the file.

user2554330
  • 37,248
  • 4
  • 43
  • 90