This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Can't find fstat() and pairwise.fstat()

Some months ago I run a calculation of the F-statistics on a set of SNP data from contiguous populations using the fstat() from hierfstat. I recently noticed that these were quite incomplete due to lack of hierarchical information, hence I've settled to repeat the calculation. Trouble is, R doesn't find any function with this name after ade4, vcfR, adegenet and hierfstat itself have been installed. I'm perplexed.

Here my commands and the machine response. I tried to install hierfstat using force = T but the result is... not the one I expected? I'm even more perplexed. I'd be very grateful if someone can give me a hint on what's happening:

> install.packages("devtools")
Installing package into ‘/home/andrea/R/x86_64-pc-linux-gnu-library/3.6’
(as ‘lib’ is unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/devtools_2.3.2.tar.gz'
Content type 'application/x-gzip' length 373387 bytes (364 KB)
==================================================
downloaded 364 KB

* installing *source* package ‘devtools’ ...
** package ‘devtools’ successfully unpacked and MD5 sums checked
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
*** copying figures
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (devtools)

The downloaded source packages are in
    ‘/tmp/RtmpkObnye/downloaded_packages’
> library(devtools)
Loading required package: usethis
> install_github("jgx65/hierfstat")
Skipping install of 'hierfstat' from a github remote, the SHA1 (0ebf5836) has not changed since last install.
  Use `force = TRUE` to force installation

> install_github("jgx65/hierfstat", force = T)
Downloading GitHub repo jgx65/hierfstat@HEAD
✓  checking for file ‘/tmp/RtmpkObnye/remotes7bb67305a1ff/jgx65-hierfstat-0ebf583/DESCRIPTION’ ...
─  preparing ‘hierfstat’:
✓  checking DESCRIPTION meta-information ...
─  checking for LF line-endings in source and make files and shell scripts
─  checking for empty or unneeded directories
─  looking to see if a ‘data/datalist’ file should be added
─  building ‘hierfstat_0.5-8.tar.gz’

Installing package into ‘/home/andrea/R/x86_64-pc-linux-gnu-library/3.6’
(as ‘lib’ is unspecified)
* installing *source* package ‘hierfstat’ ...
** using staged installation
** R
** data
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (hierfstat)
Error in fetch(key) : 
  lazy-load database '/home/andrea/R/x86_64-pc-linux-gnu-library/3.6/hierfstat/help/hierfstat.rdb' is corrupt
r snp

1 answer

I saw a couple of posts suggesting to restart your R session and try again; it may be worth a try!

https://community.rstudio.com/t/error-message-lazy-load-database-keras-rdb-is-corrupt/24381

https://github.com/thomasp85/patchwork/issues/36

I would do that plus completely rm -r /home/andrea/R/x86_64-pc-linux-gnu-library/3.6/hierfstat and install again.

Thanks to both of you. Unfortunately, that doesn't seem to work. I try to restart R both by a trivial Ctr+SHift+F10 and .rs.restartR(), together with the rm command, but the issue keep occurring. I tested install.packages("hierfstat")+ library(hierfstat) in a restarted session as well as into a new window, but none worked, again. However, I noticed that several hierfstat functions are available to use, such as fstat2dos() o fst.dosage(). It seems that the issue concerns mostly these baseline functions.

I could install it on my local machine (macOS10.14) without errors and run some of the example code. Suggest to open an issue at GitHub.

I may have reached a solution: I wasn't able to find the functions... because they weren't in the last version of the package, which I installed (05.7). Instead, they are available in the 04.22 version, I thank very much you both for the help in my troubles!

Log in to answer this question.