Error in loading file - Error in file(file, "rt")-

> pollutantmean <- function(directory, pollutant, id=1:332){
+     filelist <- list.files(path = directory, pattern = ".CSV", full.names = TRUE)
+     Value <- numeric()
+     
+     for (i in id){
+         data <- read.csv(filelist[i])
+         Value <- c(value, data[[pollutant]])
+     }
+     mean(value, no.rm = T)
+ }
> 
> pollutantmean("C:/Users/Mohamed/Documents/specdata", "sulfate")

my working hare try to read the mean for 332 file saved in directory but everytime i past the path found the below error Error in file(file, "rt") : invalid 'description' argument
i have tried / after the link but it didn't work
i have tried // but also it didn't work

that is my first code in R and it make me made from this first error

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.