[R-sig-eco] biplot question: "Error in 1L:n : argument of length 0"

Gavin Simpson ucfagls at gmail.com
Wed Jul 29 19:10:55 CEST 2015


Use the `plot()` method provided by vegan. You won't get biplots from an
NMDS as the method throws away the species data to when convert the data to
dissimilarities before generating the k-d mapping. vegan allows species
scores to be added (as the weighted averages of the site scores) if the raw
data was given to metaMDS(), but these and the site scores don't form a
traditional biplot if you mean that term specifically.

G

On 29 July 2015 at 10:36, Michael Marsh <swamp at blarg.net> wrote:

> I am trying to obtain biplots of NMDS results, ideally like the
> rpart.pca() result with mvpart.
> Can someone easily tell me why I get this error:
> Error in 1L:n : argument of length 0
> from this script, and graphical output (below) lacking labels for either
> sites or species?
> x and y matrices are shown below script.
> modifying "y" by removing NaN rows did not change output.
> Thanks!,
> Mike Marsh
> swamp at blarg.net
>
> ----------------------
> Q.wd<-as.data.frame(read.table(file.choose(),header=T))
> > #text dataset is Q.WD.foliar.revised.txt
>
> > library(vegan)
> > Q09shrub.min<-vegtab(Q09shrub,min=2)
> > Q09shrub.std<-decostand(Q09shrub.min, method="max")
> > Q09shrub.dist<- dist(Q09shrub.std)
> > Q09shrub.ward<-hclust(Q09shrub.dist,method="ward",members=NULL)
> >  NMDS.Q09shrub<-metaMDS(Q09shrub)
>
> Wisconsin double standardization
> Run 0 stress 0.08176961
> Run 1 stress 0.1011811
> Run 2 stress 0.07507627
> ... New best solution
> ... procrustes: rmse 0.04824229  max resid 0.1222105
> Run 3 stress 0.1011877
> Run 4 stress 0.07507602
> ... New best solution
> ... procrustes: rmse 0.0001471213  max resid 0.0002974951
> *** Solution reached
>
> > x<-plot(NMDS.Q09shrub, "sites")
> > y<-plot(NMDS.Q09shrub, "species")
> > biplot(x,y)
> Error in 1L:n : argument of length 0
> > ordicluster(NMDS.Q09shrub, Q09shrub.ward)
> >
> > x
> $sites
>              NMDS1       NMDS2
> 9Q05-ST -0.7781618 -0.05087985
> 9Q06-VS  0.6462465 -0.41377399
> 9Q12-ST -0.3126179 -0.80107514
> 9Q15ECS -0.8780461  0.20632944
> 9Q15WST -0.7672079  0.88777750
> 9Q16-VS  0.8652229  0.56684307
> 9Q19-ST  0.1374252 -0.41322443
> 9Q24-ST  0.3140148 -0.12115606
> 9Q26-ST -1.0044059 -0.15339828
> 9Q29-DS  0.9608797  0.35394121
> 9Q33-VS  0.8166505 -0.06138349
>
> $species
> NULL
>
> attr(,"class")
> [1] "ordiplot"
> > y
> $sites
> NULL
>
> $species
>              NMDS1       NMDS2
> ACMA3          NaN         NaN
> AMAL2  -0.05672919 -0.81171544
> ARRI2   0.84801299  0.24651319
> ARTR2  -0.93597835  0.02417604
> ARTR4  -1.01337771 -0.05343535
> GRSP           NaN         NaN
> CHVI8  -0.74187745 -0.02949452
> ERBL2          NaN         NaN
> ERNA10 -0.61157997  0.47464632
> NEST5   0.87499085 -0.04070596
> PREM   -0.90401815  1.25730322
> PRVI           NaN         NaN
> PUTR2   0.16079095 -0.36676073
> RICE   -0.35775047 -0.46386377
> ROWO           NaN         NaN
> SYAL2          NaN         NaN
> SYOR2  -0.36836460 -1.13451214
>
> attr(,"class")
> [1] "ordiplot"
> >
>
> _______________________________________________
> R-sig-ecology mailing list
> R-sig-ecology at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
>



-- 
Gavin Simpson, PhD

	[[alternative HTML version deleted]]



More information about the R-sig-ecology mailing list