On Wed, 2005-08-10 at 08:13 -0400, Kang, Sang-Hoon wrote: > As a novice I was trying to calculate Shannon diversity index using > diversity function in vegan package and kept having same error message. > Error in sum(..., na.rm = na.rm) : invalid 'mode' of argument > This error (which is from sum()) seems to come if you have non-numeric data (factors, character variables etc.). Check that your data are strictly numeric. Some of the most common cases I've seen are that row or column names are not read as row and column names but as data rows or columns. > > My dataset is from microarray and have abundant missing values, so I > tried labeling them as NA and 0, but still same error message.
> Shannon index is negative sum of proportion times log of proportion, so > I put 1 for missing values to avoid log 0, but still same error message. > You shouldn't forge your data: the function handles zeros. PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html cheers, jari oksanen -- Jari Oksanen -- Dept Biology, Univ Oulu, 90014 Oulu, Finland email [EMAIL PROTECTED], homepage http://cc.oulu.fi/~jarioksa/ ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html