Re: [R] incompatible dimensions error
Hi, It seems like the package "mvpart" is quite outdated and not available for the current R release. Since PCA is a very common need I'll suggest finding a replacement for it so that the error will either go away, or it is easier for us to reproduce it. Best, Jiefei On Tue, Aug 25, 2020 at 1:06 PM Andrew Halford wrote: > Hi Listers > > Using mvpart to run a MV regression tree with PCA= TRUE to get a PCA > plotted with sites coloured according to the tree output. > > Unfortunately it wont produce the PCA, instead giving the error message.. > > Error in cor(xall, xx[order(tree$where), ]) : incompatible dimensions. > > However, when I run a PCA on the data using the rda command I have no > problems producing a PCA. > > data is attached as a text file > > my code is thus... > fish05.hel <- decostand(fish05,"hellinger") > fish05.mrt <- > > mvpart(data.matrix(fish05.hel)~.,env,margin=0.08,cp=0,rsq=TRUE,xv="pick",xval=nrow(fish05),xvmult=100,which=4,pca=TRUE) > > The tree is produced no problem but it wont produce a PCA. > > I am just keen to understand what this error means as I dont see anything > unusual about the dataset used, notwithstanding the data is rather messy. > > Andy > > > > > > -- > Andrew Halford Ph.D > Senior Coastal Fisheries Scientist > Pacific Community | Communauté du Pacifique CPS – B.P. D5 | 98848 Noumea, > New Caledonia | Nouméa, Nouvelle-Calédonie > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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. > [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.
[R] incompatible dimensions error
Hi Listers Using mvpart to run a MV regression tree with PCA= TRUE to get a PCA plotted with sites coloured according to the tree output. Unfortunately it wont produce the PCA, instead giving the error message.. Error in cor(xall, xx[order(tree$where), ]) : incompatible dimensions. However, when I run a PCA on the data using the rda command I have no problems producing a PCA. data is attached as a text file my code is thus... fish05.hel <- decostand(fish05,"hellinger") fish05.mrt <- mvpart(data.matrix(fish05.hel)~.,env,margin=0.08,cp=0,rsq=TRUE,xv="pick",xval=nrow(fish05),xvmult=100,which=4,pca=TRUE) The tree is produced no problem but it wont produce a PCA. I am just keen to understand what this error means as I dont see anything unusual about the dataset used, notwithstanding the data is rather messy. Andy -- Andrew Halford Ph.D Senior Coastal Fisheries Scientist Pacific Community | Communauté du Pacifique CPS – B.P. D5 | 98848 Noumea, New Caledonia | Nouméa, Nouvelle-Calédonie CTE.STRICHL.SORDCHA.LTUSLAB.DIMI ACA.NANSMON.GRANZAN.CORNGOM.VARIHAL.HORT THA.LUTECHA.AURICEN.FLAVZEB.SCOPBAL.UNDU CHA.RETINAS.LITUCHA.EPHICHE.FASCTHA.HARD HEM.MELACEP.URODCHL.BLEESCA.SCHLMEL.VIDU CHE.CHLOEPB.INSISCA.PSITZEB.VELICHA.TLIS CHA.VAGALAB.BICOHIP.LONGEPI.MERRACA.NUDA CHA.LUNUCHA.ULIETHA.QUINCEP.ARGUCHL.MICR SCA.NIGEHAL.TRIMLUT.FULVLUT.GIBBSCA.DIMI CHA.CITRMAC.MELEGND.AUREAPH.FURCLUT.MONO PYG.DIACACA.TRIORHI.ACULCHE.TRILTHA.LUNA ACA.NCUSHEM.FASCTHA.PURPSCA.GLOBSCA.SPP SIG.ARGEACA.NRISHEN.CHRYHAL.CHRYOXY.UNIF SCA.FORSSCA.OVICACA.PYRONAS.UNICMON.HETE CET.OCELSCA.FRENACA.THOMFOR.FLAVPSC.HEXA STJ.BANDSCA.FLAVPSE.PASCSIG.VULPACA.LINE ACA.OLIVMEL.NIGESUF.BURSCHA.KLEICHE.UNDU COR.GAIMHAL.RICHMCR.NIGESCA.GHOBCHA.MERT FOR.LONGHAL.MELALUT.BOHACEN.LORICTE.CYAN SUF.CHRYHTY.POLYLBY.UNILPSC.TETRTHA.AMBL ACA.BLOCCHA.MELACHA.MEYECHE.SPP HAL.MTUS NOV.TAENLET.HARALUT.SEMISCO.LINECEN.BICO SCA.SPINACA.MACUACA.SPP CHA.LINECHA.PUNC KYP.VAIGANA.MELECOR.BATULAB.PECTOXY.DIGR STJ.STRIMCR.MACUSCA.ALTISCA.RIVUPMS.AREO CTE.STRGNAS.BREVNAS.HEXACHA.SEMEHEN.MONO ANA.MELAANA.TWISCOR.AYGUHAL.SPP SCO.BILI CEN.VROLPCA.IMPESCA.FESTSIG.FUSCACA.MATA NAS.CAESHAL.PROSHAL.SCAPLBS.MICRTHA.TRIL SCA.RUBRPSE.BARTSIG.PUEL DrenmeoMPA_Tr4_2011 75 41 5.5 38.50 3 0 1 0 2 3.5 9.5 26 0 0.5 1 0.5 2 7.5 1.5 1 0 0 0 0 0 0 0.5 3.5 0 1 2.5 1.5 0 0.5 1.5 0 0.5 0 0.5 3 0 0 0 0 0 0 0 1.5 0.5 0 0 0 0 0 0 0 21.32.5 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0.5 0 0 0 0 0 0 0 0.5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 0 0 0 0 0 0 0 0 4.5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 14 0 0 0 0 0 0 0 0 0 0 0 0 0 0 DrenmeoMPA_Tr10_20114.5 9 2 12.50 0 0 1 1 2.5 0 0.5 0 0 1 0 0 0 0.5 0 0 0 0 0 1.5 0 0 0 2 0 0 0 1 0 0 0 0 0 0 0 28 0 0 0 0 0 0 0 0 0