Make_network error in R Error - "veg_distance" is not available for .C () for package "vegan"
I get an error when running make_work from the "vegan" R package:
net <- make_network(ps)
Error in .C("veg_distance", x = as.double(x), nr = N, nc = ncol(x), d = double(N * :
"veg_distance" not available for .C() for package "vegan"
Here is my sesion info:
R version 3.4.4 (2018-03-15)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
Matrix products: default
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] vegan_2.5-1 lattice_0.20-35 permute_0.9-4
[4] phyloseqGraphTest_0.0.1 ggplot2_2.2.1 phyloseq_1.22.3
I've seen other cases related to this error that advised uninstalling and reinstalling vegan, which I did (hence the latest package update) to no avail.
This is most likely an issue with phyloseq interacting with vegans . At least a similar issue has been reported in both vegan and phyloseq on github. The alternatives seem to be as follows:
- You can try if reinstalling phyloseq (to the same version) after vegan . Update 2.5-1 will help: it seems that phyloseq keeps the vegan feature when installed or built (I don't know either), and it will use that closed version even if veganization changes .
- Lower rating vegan to 2.4-6, which is the new version with the old internal elements (which were also used in phyloseq ).
- Wait for the problem to be fixed in phyloseq .
- If possible, try to find a workaround.
I had the same problem (with a different function from phyloseq, ordinate ()) and think I got it to work. People discussed this in detail: https://github.com/joey711/phyloseq/issues/921 . I'll leave here what worked for me by reading the cjfields advice on the page linked above.
# First get stringi straight
install.packages("stringi", configure.args="--disable-pkg-config")
library(stringi)
packageVersion("stringi")
# Vegan
install.packages("vegan")
library(vegan)
packageVersion('vegan') #should be 2.5-1 (or more recent, if someone reads this later)
# Phyloseq. Install the latest version from github (the version on other repos may still have the bug)
library("devtools")
install_github("joey711/phyloseq")
library(phyloseq)
packageVersion('phyloseq')
Before that, I tried to downgrade vegan and install phyloseq again, with no success.