HI, I am very new to R (and programming in general) and am taking a class in it now. I am getting creamed. I want the last part of the function statement below to give me the mean of the data set of nitrates. When I do it I get an error statement stating:
Error in pollutantmean$nitrate : object of type 'closure' is not subsettable I am bringing in 332 records. I want the mean of nitrates for 52 of those records. Any suggestions would be helpful. pollutantmean <- function(specdata, nitrate,id = 1:332){ files<-list.files(specdata, full.names = TRUE) dat<-data.frame() for (i in 280:332) dat <- rbind(dat, read.csv(files_full[i])) } str(pollutantmean) mean(pollutantmean$nitrate, na.rm = TRUE) [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.