I'm new to R, and after researching this error extensively, I'm still not able to find a solution for it. Here's the code. I've checked my working directory, and made sure the files are in the right directory. Appreciate it. Thanks
**pollutantmean <- function(id, directory, ...){
x <- c(NA)
for(i in id){
csvfile <- sprintf("%03d.csv", i)
filepath<- file.path(directory,csvfile)
foo <- read.csv(filepath, ...)
x <- x+foo
}
mean(x,na.rm=TRUE)
}**
OK, and then ,I type the code like this:
pollutantmean(1:10,"specdata","sulfate")
Then, I got a trackback:
*Error in file(file, "rt") : cannot open the connection
In addition: Warning message: In file(file, "rt") : cannot open file 'specdata/001.csv': No such file or directory*
I'm confused, how should I solve this problem?