Could not find function "gstat.randtest"

Hi all,

I am having a lot of difficulty trying to use gstat.randtest in RStudio. All packages are in (ade4, adegenet, hierfstat) and data is in genind. Latest version of R (4.0.3).

#script:
gtest <- gstat.randtest(obj2,nsim=99)
gtest
plot(gtest)

Console:

gtest <- gstat.randtest(obj2,nsim=99)
Error in gstat.randtest(obj2, nsim = 99) :
could not find function "gstat.randtest"

Even using the nancycats genind, I still get the same error.

I am working through the basic tutorial for adegenet. Closed RStudio and loaded everything again but to no avail.

Any help or tips would be really appreciated.

Thank you

Libraries need to be loaded into R sessions

library(adegenet)
getAnywhere(gstat.randtest)
sessionInfo()

Hi nigrahamuk,

This is what I get back from those commands:

Console:

gtest <- gstat.randtest(obj2,nsim=99)
Error in gstat.randtest(obj2, nsim = 99) :
could not find function "gstat.randtest"
gtest
Error: object 'gtest' not found
getAnywhere(gstat.randtest)
no object named ‘gstat.randtest’ was found
sessionInfo()
R version 4.0.3 (2020-10-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18363)

Matrix products: default

locale:
[1] LC_COLLATE=English_United Kingdom.1252
[2] LC_CTYPE=English_United Kingdom.1252
[3] LC_MONETARY=English_United Kingdom.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United Kingdom.1252

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] pegas_0.14 ape_5.4-1 adegenet_2.1.3 readxl_1.3.1
[5] hierfstat_0.5-7 ade4_1.7-16

loaded via a namespace (and not attached):
[1] splines_4.0.3 gtools_3.8.2 shiny_1.5.0
[4] assertthat_0.2.1 expm_0.999-5 sp_1.4-4
[7] cellranger_1.1.0 LearnBayes_2.15.1 progress_1.2.2
[10] pillar_1.4.7 lattice_0.20-41 glue_1.4.2
[13] digest_0.6.27 promises_1.1.1 colorspace_2.0-0
[16] htmltools_0.5.0 httpuv_1.5.4 Matrix_1.2-18
[19] plyr_1.8.6 pkgconfig_2.0.3 raster_3.4-5
[22] gmodels_2.18.1 purrr_0.3.4 xtable_1.8-4
[25] scales_1.1.1 gdata_2.18.0 later_1.1.0.1
[28] tibble_3.0.4 mgcv_1.8-33 generics_0.1.0
[31] ggplot2_3.3.2 ellipsis_0.3.1 cli_2.2.0
[34] magrittr_2.0.1 crayon_1.3.4 mime_0.9
[37] deldir_0.2-3 fansi_0.4.1 nlme_3.1-150
[40] MASS_7.3-53 class_7.3-17 vegan_2.5-6
[43] tools_4.0.3 prettyunits_1.1.1 hms_0.5.3
[46] lifecycle_0.2.0 stringr_1.4.0 munsell_0.5.0
[49] cluster_2.1.0 compiler_4.0.3 e1071_1.7-4
[52] rlang_0.4.8 classInt_0.4-3 units_0.6-7
[55] grid_4.0.3 rstudioapi_0.13 igraph_1.2.6
[58] boot_1.3-25 gtable_0.3.0 codetools_0.2-18
[61] DBI_1.1.0 reshape2_1.4.4 R6_2.5.0
[64] dplyr_1.0.2 utf8_1.1.4 fastmap_1.0.1
[67] seqinr_4.2-4 spdep_1.1-5 KernSmooth_2.23-18
[70] permute_0.9-5 stringi_1.5.3 parallel_4.0.3
[73] Rcpp_1.0.5 vctrs_0.3.5 sf_0.9-6
[76] spData_0.3.8 tidyselect_1.1.0 coda_0.19-4

Hi,

Sorry if I wasn't clear. Libraries of these have been loaded.

install.packages("devtools")
library(usethis)
library("devtools")

install.packages("ade4")
library("ade4")
install.packages("adegenet")
library("adegenet")
install.packages("hierfstat")
library("hierfstat")

All loaded correctly without errors and get:

gtest <- gstat.randtest(obj2,nsim=99)
Error in gstat.randtest(obj2, nsim = 99) :
could not find function "gstat.randtest"

According to this


. That function was removed from that package back in 2015. Supposedly would be in hierfstat, but not in that name, perhaps it got renamed along the way. Perhaps contact / raise an issue with the package developer...

Right, that would make sense. I will see what it may have been renamed to and, failing that, will contact the package developer.

Thank you very much for your help.