[R] Help with RDA analysis, function ''varpart'' in vegan

Bert Gunter bgunter.4567 at gmail.com
Sun Sep 17 16:56:21 CEST 2017


Doubt that will make any difference.

My guess is that there is a function in the environment that varpart wants
to use as an object -- i.e. there is a scoping bug in varpart. But that
could be baloney, too.

Please learn about R's debugging tools. Give us the results of traceback()
after the error.

-- Bert



Bert Gunter

"The trouble with having an open mind is that people keep coming along and
sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )

On Sun, Sep 17, 2017 at 1:23 AM, Eric Berger <ericjberger at gmail.com> wrote:

> I am not familiar with the vegan package, so I am just making a guess here.
> If 'na.action=na.omit' is part of the call to varpart, try removing it from
> the function call and moving it above as follows:
>
> options(na.action="na.omit")
> RDA_Ger <- varpart(comm, x1, x2, x3, transfo="hellinger", scale = FALSE)
>
> Maybe that will help.
>
> Regards,
> Eric
>
> On Sat, Sep 16, 2017 at 6:53 PM, Sophi Marmen <sofimarman at gmail.com>
> wrote:
>
> > I'm trying to perform a RDA analysis in the vegan package using the
> > "varpart"  function.
> >
> > I have a matrix of community structure data in different sites (rows),
> > which I want to explain using 3 matrices of environmental data. The 3
> > matrices are:
> >
> > water quality parameters;
> >
> > local land use variables;
> >
> > total land use variables.
> >
> > In each matrix, the number of the rows is the same (the sites) and there
> > are different column number (measured varibakes).
> >
> > I use the follow script:
> >
> > WQ_RDA <- read.csv("F:/Sher_sophi_new3/RDA/WQ_RDA_1.csv", row.names = 1)
> > LU2_loc_RDA <- read.csv("F:/Sher_sophi_new3/RDA/LU2_loc_RDA_1.csv",
> > row.names = 1)
> > LU2_bas_RDA <- read.csv("F:/Sher_sophi_new3/RDA/LU2_basin_RDA_1.csv",
> > row.names = 1)
> > comm <- read.csv("F:/Sher_sophi_new3/RDA/Final_true_OTUs_97_1.csv",
> > row.names = 1)
> >
> > x1 = as.matrix(WQ_RDA)
> > x2 = as.matrix(LU2_loc_RDA)
> > x3 = as.matrix(LU2_bas_RDA)
> > comm = as.matrix(t(comm))
> >
> > RDA_Ger = varpart(comm, x1, x2, x3, transfo="hellinger", scale = FALSE,
> >                   na.action = na.omit
> >
> >
> > I get this error message:
> >
> > Error in as.vector(x, mode) :
> >   cannot coerce type 'closure' to vector of type 'any'
> >
> > Can anyone help me figure out what am I doing wrong?
> >
> > Thanks,
> > Sophi
> > --
> > Sophi Marmen
> > Ph.D candidate
> > Marine Biology Department
> > Leon H. Charney School of Marine Sciences
> > University of Haifa, Israel
> >
> >         [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > R-help at 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 at 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]]



More information about the R-help mailing list