R Recompiling documentation & package unload results in lazy-load error - r

I'm using Roxygen2 to document my R (3.2.4) package and have several windows open as I fix my function #examples:
1) R session where I type devtools::document() to update the Rd file
2) terminal window where I reinstall the package with the updated doc using
R CMD INSTALL myPackage
3) R session where I unload/reload the package and look at the updated documentation:
> detach(package:myPackage,unload=TRUE);require(myPackage)
> ?myTestFunc
The problem is in window 3. After running the detach() and require(), typing ?myTestFunc gives me the following error:
Error in fetch(key) :
lazy-load database '/Library/Frameworks/R.framework/Versions/3.2/Resources/library/netDx/help/myTestFunc.rdb' is corrupt
In addition: Warning message:
In fetch(key) : internal error -3 in R_decompress1
Restarting R allows me to run ?myTestFunc and see the updated documentation.
How do I unload and reload the package "completely" without having to start R each time?
Thanks for your time!
PS - some output from sessionInfo(), incase it helps.
> sessionInfo()
R version 3.2.4 (2016-03-10)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.10.5 (Yosemite)

Related

How to Fix error loading plotKML package in R

During the installation I had no problem,
I need to use this package but when loading it I have an error that does not allow me to use it properly
I have already tried the restart R trick but this persists; below the error:
> library(plotKML)
#Error: package or namespace load failed for ‘plotKML’ in get(Info[i, 1], envir = env):
#lazy-load database 'C:/Users/User/Documents/R/win-library/4.1/e1071/R/e1071.rdb' is corrupt
#In addition: Warning message:
#In get(Info[i, 1], envir = env) : internal error -3 in R_decompress1
I was using R version 4.1.0 and update to 4.1.1 in order to solve this but the problem persists
the platform is: i386-w64-mingw32 / i386 (32-bit)
I do it through Rstudio Version 1.0.153
Any idea how to fix it?
I am new at this :)
Dave2e thanks for your comentary, it really worked, only it gave me 2 errors similar to the one presented in the question and consecutive after reinstalling the package e1071:
#lazy-load database'C:/Users/User/Documents/R/win-library/4.1/aqp/R/aqp.rdb' is corrupt'
#lazy-load database'C:/Users/User/Documents/R/win-library/4.1/gstat/R/gstat.rdb' is corrupt'
sorry I did not copy the complete code as I was amused to find a way forward. and I'm sure the error lines on the console weren't 100% the same
to which, under the same logic, reinstall the "aqp" and "gstat" packages , restarting Rstudio between each installation, since when trying to load the plotKML package immediately in the same session the error persists
here the victory:
> library(plotKML)
plotKML version 0.8-1 (2021-04-12)
URL: https://github.com/Envirometrix/plotKML/
Warning message:
R graphics engine version 14 is not supported by this version of RStudio. The Plots tab will be disabled until a newer version of RStudio is installed.

Error: Install papaja package and updating R

Problem: I was trying to install the papaja package
devtools::install_github("crsh/papaja")
I received this error:
Error: Failed to install 'reprex' from GitHub:
System command 'Rcmd.exe' failed, exit status: -1, stdout + stderr empty
To potentially resolve this error, I tried to update R and this came up:
Warning message:
In shell(install_cmd, wait = wait, ...) :
'C:\Users\naomi\AppData\Local\Temp\RtmpyQPZSR/R-4.0.3-win.exe' execution failed with error code 127
The first error is my main issue which I am trying to resolve. I would appreciate your help with diagnosing both.
This is my current R version: R version 4.0.2 (2020-06-22)
There are several potential issues and it isn't completely clear to me what the issue is just judging from the error code. Here's what I'd try to do:
Check your installation of Rtools and if it is the right version for R 4.0.2
Check if devtools is updated/reinstalled after upgrading to R 4.0.2 (potentially from 3.x.x)
Try installing R 4.0.3 using admin rights, then it should work.
If you still can't install using devtools, try to download the package as .tar.gz and install from the local file.
I hope this helps. I will check if my suggestions helped you out.

RStudio not loading RevoScaleR on Ubuntu 16.04

Long story short:
Calling rxImport() works fine in a Terminal R session but fails when using RStudio, despite using the same installation of R.
Setup:
I'd like to use RevoScaleR functions like rxImport(...) on Ubuntu. I have an installation of RStudio and R done through package manager.
I've installed MS Rclient following the instructions here.
Everything seems to work as I can run in the terminal:
/opt/microsoft/rclient/3.4.3/bin/R$ ./R
R version 3.4.3 (2017-11-30) -- "Kite-Eating Tree"
Copyright (C) 2017 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
...
Microsoft R Open 3.4.3
The enhanced R distribution from Microsoft
Microsoft packages Copyright (C) 2018 Microsoft
Loading Microsoft R Client packages, version 3.4.3.0097.
Microsoft R Client limits some functions to available memory.
See: https://go.microsoft.com/fwlink/?linkid=799476 for information
about additional features.
...
Using the Intel MKL for parallel mathematical computing (using 2 cores).
Default CRAN mirror snapshot taken on 2018-01-01.
See: https://mran.microsoft.com/.
> R.home()
[1] "/opt/microsoft/rclient/3.4.3/runtime/R"
> rxImport()
Error in rxImport() : 'inData' must be specified.
So the function is loaded and available by default. Now I tell the RStudio to use this installation of R by adding the following at the end of ~/.profile :
RSTUDIO_WHICH_R="/opt/microsoft/rclient/3.4.3/bin/R/R"
Error:
When I run rstudio I get a R console in the IDE saying:
> R.home()
[1] "/opt/microsoft/rclient/3.4.3/runtime/R"
> rxImport()
Error in rxImport() : could not find function "rxImport"
Possible causes
I've found some threads with people complaining about MS packages not dealing properly with ~ and working directory (i.e. on a remote server), setwd() doesn't solve my issue, though.
Do you have any ideas on how to get RevoScaleR to work with RStudio? Thanks in advance.
An answer I got from Github:
https://github.com/rstudio/rstudio/issues/2455#issuecomment-375327109
try setting
R_LIBS_SITE=/opt/microsoft/rclient/3.4.3/libraries/RServer
in
/opt/microsoft/rclient/3.4.3/runtime/R/etc/Renviron

Problems installing Slidify in RStudio

I am new to R-programming and I am trying to install Slidify and I am currently having a problem. I am running on the below version of RStudio:
R version 3.2.3 (2015-12-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
I am using the below code to install Slidify:
install_github("slidify", "ramnathv")
install_github("slidifyLibraries", "ramnathv")*
I get the following error:
'C:\Program' is not recognized as an internal or external command, operable program or batch file.
Error: Command failed (1)
In addition: Warning message:
Username parameter is deprecated. Please use ramnathv/slidifyLibraries
I have also tried the below code to install Slidify:
pkgs <- c('ramnathv/slidifyLibraries', 'ramnathv/slidify')
devtools::install_github(pkgs)*
and I get the following error:
Error: Command failed (1)
Does anyone have experience installing Slidify?
1) install_github() function is in devtools package, so first you have to install this package using install.packages("devtools").
2) Then load the library using
library(devtools)
3) Now use your code
install_github("slidify", "ramnathv")
install_github("slidifyLibraries", "ramnathv")
It will work properly.

install_github returning error: zip file can't be opened

when I run the following:
library(devtools)
install_github('roxygen2')
I get the following error:
with devtools 0.51:
Installing roxygen2 from hadley
Error in unzip(src, list = TRUE) :
zip file '/tmp/Rtmp2b44Ug/hadley-roxygen2.zip' cannot be opened
I installed a more recent version (0.6) of devtools: install_github('devtools')
and the error is more informative, but similar:
> install_github('roxygen')
Installing github repo(s) roxygen/master from hadley
Installing roxygen.zip from https://github.com/hadley/roxygen/zipball
Error in expand(src, list = TRUE) :
zip file '/tmp/Rtmp2b44Ug/roxygen.zip' cannot be opened
In addition: Warning message:
In expand(src, exdir = tempdir()) : error 1 in extracting from zip file
Am I doing something wrong?
> sessionInfo()
R version 2.14.1 (2011-12-22)
Platform: x86_64-pc-linux-gnu (64-bit)
...
This error occurs because the function install_github sets username='hadley' by default (see install-github.r source)
In this case, there is no github branch hadley/roxygen, and now download from https://github.com/hadley/roxygen/zipball/master
This will work:
install_github('roxygen',username = 'klutometis')
note: even though the package is called roxygen2, the "repo" name is "roxygen"
I opened a bug in devtools

Resources