[R] Cannot subset a specific mean from this function
Bradley Wolf
chanmo5752 at gmail.com
Fri Dec 18 05:06:19 CET 2015
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]]
More information about the R-help
mailing list