I use Windows and R 3.5.0
I am a beginner and have a problem with a basic code. I have defined a function which takes 3 arguments - findmean("path", "variable", id). The data frame has several columns and I have to find the mean of one of the columns. When I find the mean of the "AGE" column using
mean(finaldata$AGE,na.rm=TRUE)
and run
findmean("path", id = 1: 5)
i get the correct mean, but when i change it to
mean(finaldata$variable, na.rm = TRUE)
and run
findmean("path", "AGE", id = 1:5)
I am getting an error: argument is not numeric or logical: returning NA.
Please tell me where i am going wrong.