Hello helpers, I have a two part issue. FIRSTLY, I am attempting to write a function for coefficient of variation, using
> co.var <- function(rowleyi) ( 100*sd(rowleyi)/mean(rowleyi) ) #where rowleyi > is my data set, which has multiple columns and rows of data. This is not working because some of my columns have NAs. When I try to use > co.var(rowleyi$TL, na.rm=TRUE) #where TL is one of my column names, it gives > me an error message: Error in co.var(rowleyi$TL, na.rm = TRUE) : unused argument(s) (na.rm = TRUE) I do not know what this means. How can I get this function to work? SECONDLY, how can I then get that function to work within an aggragate? Do I still use >aggregate(. ~ subspecies, data = rowleyi, CV, na.rm=TRUE) #where subspecies is >the header for rows? This has worked for mean, std.error, sd, etc. Thank you! Amanda Jones ______________________________________________ R-help@r-project.org mailing list 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.