[R] NA handling problem in capscale (vegan)

Gavin Simpson gavin.simpson at ucl.ac.uk
Thu Nov 11 16:54:45 CET 2010


On Thu, 2010-11-11 at 18:14 +1100, Nevil Amos wrote:
> I am having a problem with NA handling in capscale function.
> 
> as I understand it from the help capscale should permit NA values when 
> na.action=na.mit or na.exclude,
> 
> however I am getting  the error
> 
> Error in X[nas, , drop = FALSE] : incorrect number of dimensions
> 
> trivial example is pasted below.
> 
> library(vegan)
> mydist<- matrix(1:25, 5, 5)
> mydata<-matrix(rnorm(1:25),5,5)
> mydata[3,1]<-NA
> mydata<-data.frame(mydata)
> 
> capscale(mydist~X1+X2+Condition(X3),data=mydata,na.action = na.omit)
> 
> 
> Thanks
> 
> Nevil Amos

It is failing within the formula parsing code because ordiParseFormula
thinks the response is a matrix but it was getting a dissimilarity
matrix in class "dist" form.

I think Jari has just fixed this in the R-Forge svn sources, but that
revision has not yet been built on the R-Forge build system. Check back
here later:

https://r-forge.r-project.org/R/?group_id=68

Thanks for the report.

G

-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Dr. Gavin Simpson             [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,          [f] +44 (0)20 7679 0565
 Pearson Building,             [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London          [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT.                 [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%



More information about the R-help mailing list