I am trying to read files from a folder. I set the working directory and the target folder.
setwd("F://directory/SimulationOutputs/folder - Copy/")
spwfolder <- ("F:/directory/SimulationOutputs/folder - Copy/spws/")
spws <- list.files(spwfolder)
After this step, I check to see if it is getting it right:
spws[1]
[1] "Cambridge2018_136.txt"
Next, I want to read the first file:
spw<-read.table(spws[1], sep=";", row.names=NULL, skip = 8, fill = TRUE,
header=TRUE, stringsAsFactors = FALSE)
And I get this message:
Error in file(file, "rt") : cannot open the connection In addition: Warning message: In file(file, "rt") : cannot open file 'Cambridge2018_136.txt': No such file or directory
What am I doing wrong? Thanks in advance!