Hii rstudio members I am learning rstudio, For my manuscript I am trying to plot CCA using species and environmental data. But I am getting error like Error in cca.default(sptrans, envtrans) : all row sums must be >0 in the community data matrix *My code is like * library(vegan) library(ggplot2) library(dplyr) rassspec<-read.csv("C:/Users/hp/Desktop/R_data/rassspec.csv", header=T, stringsAsFactors=T) rassevee<-read.csv("C:/Users/hp/Desktop/R_data/rassenv.csv", header=T, stringsAsFactors=T) sptrans <- decostand(rassspec, "hellinger") envtrans <- decostand(rassevee, "hellinger") vare.cca <- cca(sptrans, envtrans) Any kind of help will be appreciable Thanking you regards Shailendra Pal Research Scholar Plant Ecology Lab (Prof. S.C. Garkoti) School of Environmental Sciences JNU, New Delhi 110067 [[alternative HTML version deleted]]
Dear Shailendra Pal, Welcome to the R-help mailing list! Most of us are not members of RStudio in any way. Your problem is also purely about programming in R, so you've come to the right place. You have also done the right thing by showing us the code. On Fri, 8 Dec 2023 16:08:51 +0530 shailendra pal <palshailendra9 at gmail.com> wrote:> vare.cca <- cca(sptrans, envtrans)> Error in cca.default(sptrans, envtrans) : > all row sums must be >0 in the community data matrixOne of the most important tools provided by R is its online help system. Use it to look up the documentation for the function you're having problems with. You can prepend a question mark to most function calls and get a help page in response; failing that, help('cca') should also work. Here's what it says:>> ## Default S3 method: >> cca(X, Y, Z, ...)>> X Community data matrix. >> Y Constraining matrix, typically of environmental variablesIn other words, the "community data matrix" mentioned in the error message is your `sptrans` data.frame. The function complains that at least some of the rows don't have a positive sum, which is a requirement of the method. Can you spot the problem by looking at the data or using rowSums()? -- Best regards, Ivan
Dear Shailendra, For me the problem is not related to R or Rstudio or even vegan. The CCA analysis can not be done with denuded site, as the sum will be zero. "all row sums must be >0 in the community data matrix" Best regards, GCC <avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail> N?o cont?m v?rus.www.avg.com <avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail> <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2> Em s?b., 9 de dez. de 2023 ?s 06:50, shailendra pal < palshailendra9 at gmail.com> escreveu:> Hii rstudio members > I am learning rstudio, For my manuscript I am trying to plot CCA using > species and environmental data. But I am getting error like > Error in cca.default(sptrans, envtrans) : > > all row sums must be >0 in the community data matrix > > > *My code is like * > library(vegan) > library(ggplot2) > library(dplyr) > rassspec<-read.csv("C:/Users/hp/Desktop/R_data/rassspec.csv", header=T, > stringsAsFactors=T) > rassevee<-read.csv("C:/Users/hp/Desktop/R_data/rassenv.csv", header=T, > stringsAsFactors=T) > sptrans <- decostand(rassspec, "hellinger") > envtrans <- decostand(rassevee, "hellinger") > > vare.cca <- cca(sptrans, envtrans) > > > Any kind of help will be appreciable > Thanking you > regards > > Shailendra Pal > > Research Scholar > Plant Ecology Lab > (Prof. S.C. Garkoti) > School of Environmental Sciences > JNU, New Delhi > 110067 > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >-- Gilson Correia de Carvalho ---------------------------------------------------- Doutor em Ecologia *(PhD. in Ecology)* Mestre em Ecologia e Biomonitoramento* (Master in Ecology and Biomonitoring) * Bacharel em Ci?ncias Biol?gicas *(Bachelor in Biological Sciences)* CV Lattes: lattes.cnpq.br/8361386734266580 ResearcherID: F-8051-2014 Scopus Author ID: 35236290200 ORCID ID: orcid.org/0000-0003-1800-888X Google Scholar: Rj5FlvYAAAAJ&hl ---------------------------------------------------- Chefe do Departamento de Biotecnologia (Head of the Department of Biotechnology) ---------------------------------------------------- Professor Associado I *(Associate Professor Level I of IV)* Departamento de Biotecnologia *(Department of Biotechnology)* Instituto de Ci?ncias da Sa?de *(Institute of Health Sciences)* Universidade Federal da Bahia *(Federal University of Bahia)* ----------------------------------------------------- S?cio-Cotista *(Shareholder)* Holos Solu??es Ambientais Ltda ----------------------------------------------------- Skype: bio_gilson Hangouts: biogilson [[alternative HTML version deleted]]