开发者

How to correct for "Error in nullmodel(comm, method) : could not find function "list2env" in the vegan package

开发者 https://www.devze.com 2023-04-10 16:02 出处:网络
I\'m busy exploring the package vegan for R, using it to calculate nestedness of community matrices and null models. I\'m particularly interested in using the permat functions as well as Oecosimu.

I'm busy exploring the package vegan for R, using it to calculate nestedness of community matrices and null models. I'm particularly interested in using the permat functions as well as Oecosimu.

However, when running my program I obtained the following errors:

Error in nullmodel(comm, method) : could not find function "list2env" Error in nullmodel(m, ALGO) : could not find function "list2env"

I then even ran an example (given below) of how to use these functions given by the R help function, and even these examples gave the same error. Am I suppose to import something else in order to use these functions or how do I go about fixing this?

Examples:

m <- matrix(c(
   1,3,2,0,3,1,
   0,2,1,0,2,1,
   0,0,1,2,0,3,
   0,0,0,1,4,3
   ), 4, 6, byrow=TRUE)

x1 <- permatswap(m, "quasiswap")

summary(x1)

x2 <- permatfull(m)

summary(x2)

x3 &开发者_如何学Clt;- permatfull(m, "none", mtype="prab")

x3$orig  

summary(x3)

x4 <- permatfull(m, strata=c(1,1,2,2))

summary(x4)


Technically, this is a bug in the development version of Vegan on R-Forge. We were failing to declare a dependency on R versions >= 2.12 in DESCRIPTION. I have checked in the relevant change to the source tree to fix this but it will take a day or so before the tarball and binaries are rebuilt by R-Forge.

That said, you should probably update your R to something more recent. Or use the versions of those functions provided in Vegan 2.0-x on CRAN.


list2env is part of R base, which means it comes with the distribution, not in an add-on package. So if you don't have it you're probably either running an old version of R or have a broken installation. The example worked fine for me, with R 2.12.1 and vegan 2.1-0.


Your code works for me without an error message

The most probable cause of your error is your using old versions of R, vegan or permute

The R news for changes says

CHANGES IN R VERSION 2.12.0: NEW FEATURES:

o New list2env() utility function as an inverse of
  as.list(<environment>) and for fast multi-assign() to existing
  environment.  as.environment() is now generic and uses list2env()
  as list method.

CHANGES IN R VERSION 2.12.1: BUG FIXES:

o When list2env() created an environment it was missing a PROTECT
  call and so was vulnerable to garbage collection.

CHANGES IN R VERSION 2.13.0: NEW FEATURES:

o list2env(envir = NULL) defaults to hashing (with a suitably sized
  environment) for lists of more than 100 elements.

So update your version of R and the packages and try again.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号