Cannot devtools::install_github() with R 3.6.1 - r

I recently updated from R 3.5.3 to R 3.6.1 and rerun all my script. Unfortunately, I appear not to be able to install packages from GitHub repos. I have a slightly modified package that sits in my GH repo that is necessary for some scripts. With R 3.5.3 everything went smoothly, but with the most recent version I get the following error
Downloading GitHub repo ceschi/urcabis#master
v checking for file 'C:\Users\...\AppData\Local\Temp\RtmpCChTCy\remotes27985bc713f5\ceschi-urcabis-aeb1bdc/DESCRIPTION' (439ms)
- preparing 'urca': (910ms)
v checking DESCRIPTION meta-information ...
- cleaning src
- 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 'urca_1.3-0.tar.gz'
Installing package into ‘C:/Users/.../Documents/R/win-library/3.6’
(as ‘lib’ is unspecified)
ERROR: failed to lock directory 'C:/Users/.../Documents/R/win-library/3.6' for modifying
Try removing 'C:/Users/.../Documents/R/win-library/3.6/00LOCK-urca'
Error: Failed to install 'urca' from GitHub:
(converted from warning) installation of package ‘C:/Users/EB74A~1.FRA/AppData/Local/Temp/RtmpCChTCy/file27989b74233/urca_1.3-0.tar.gz’ had non-zero exit status
I tried removing all locked directories, installing on older versions of R, but it seems nothing's working. Any suggestions?
Thanks in advance!
EDIT/UPDATE: for some mysterious reason the error solved itself apparently. Thanks to everyone for helping!

Related

rgdal not installing in R? "non-zero exit status?"

I am trying to install the package rgdal on a new MacOS 12.2.1. I have the newest version of R, and it has not been working much to my frustration. When I use the command "install.packages("rgdal")," a prompt is displayed: "Do you want to install from sources the package which needs compilation? (Yes/no/cancel)" I've tried this multiple times, selecting both yes and no, because I really have no idea what this prompt even means. Anyways, R downloads a bunch of necessary packages with no problem, but then when it gets to the end of the downloading process, this displays:
configure: error: gdal-config not found or not executable.
ERROR: configuration failed for package ‘rgdal’
* removing ‘/Library/Frameworks/R.framework/Versions/4.2/Resources/library/rgdal’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/4.2/Resources/library/rgdal’
The downloaded source packages are in
‘/private/var/folders/t5/dqf_shjn2v79xfnycl1thkxh0000gn/T/Rtmpz3gATu/downloaded_packages’
Warning message:
In install.packages("rgdal") :
installation of package ‘rgdal’ had non-zero exit status
I have no idea what this means! I'm tired, confused, upset, I have little experience with coding at all and yeah this is just not an ideal situation! If anyone with more experience with R understands what is happening, I'd love help!
Thank you!

Cannot install tsDyn package in RStudio, 'mnormt' doesn't exist

I am trying to install the tsDyn package on my Macbook Pro running MacOSX Catalina version 10.15.2. in RStudio (v.1.3.959), running R (v.4.0.1). I get the following error:
ERROR: compilation failed for package ‘mnormt’
* removing ‘/Library/Frameworks/R.framework/Versions/4.0/Resources/library/mnormt’
Warning in install.packages :
installation of package ‘mnormt’ had non-zero exit status
I tried installing 'mnormt' myself, as well as deleted all irrelevant packages manually to get rid of any possible older versions that may be interfering with the 'tsDyn' package, but nothing seems to be working.
The 'tsDyn' package seems to be installing otherwise, but I cannot call the function 'VECM' because it R states that it does not exist.
Any help would be much appreciated.
If you are using Anaconda, inside Environments search for "r-mnormt" and install from there. Also you can try inside RStudio:
install.packages("r-mnormt")
It should work now.

SAP NetWeaver & R

I found that the issue on how to connect R to SAP is as old as year 2012
For example link below, there's a tutorial on how to link R and SAP
https://blogs.sap.com/2012/06/21/analytics-with-sap-and-r-windows-version/
The R package to link R and SAP is
https://github.com/piersharding/RSAP
I have the SAP GUI for Windows installed on my machine as below:
Based on the install script here, I need to specify the path to nwrfcsdk folder:
https://github.com/piersharding/RSAP/blob/master/INSTALL
library(devtools)
install_github('RSAP', username='piersharding', args=c("--configure-args=--with-nwrfcsdk-include=C:/nwrfcsdk/include --with-nwrfcsdk-lib=C:/nwrfcsdk/lib' --no-clean-on-error"))
When I look at my current SAP GUI for Windows installation path, there's no lib folder.
So I'm not sure how can I make the installation.
UPDATE
I've asked my IT team to get me the nwrfcsdk, which I then parked at C:\
However I still face installation issue
> remotes::install_github('piersharding/RSAP', args=c("--configure-args='--with-nwrfcsdk-include=C:/nwrfcsdk/include --with-nwrfcsdk-lib=C:/nwrfcsdk/lib' --no-clean-on-error"))
Downloading GitHub repo piersharding/RSAP#master
√ checking for file 'C:\Users\AppData\Local\Temp\Rtmp6Fl8b5\remotes247857351b30\piersharding-RSAP-94103bc/DESCRIPTION' (555ms)
- preparing 'RSAP':
√ checking DESCRIPTION meta-information ...
- cleaning src
- checking for LF line-endings in source and make files and shell scripts (1.5s)
- checking for empty or unneeded directories
- building 'RSAP_0.13.tar.gz'
Warning: file 'RSAP/cleanup' did not have execute permissions: corrected
Warning: file 'RSAP/configure' did not have execute permissions: corrected
Installing package into ‘C:/Users/Documents/R/win-library/4.0’
(as ‘lib’ is unspecified)
* installing *source* package 'RSAP' ...
** using staged installation
** libs
Error: (converted from warning) this package has a non-empty 'configure.win' file,
so building only the main architecture
* removing 'C:/Users/Documents/R/win-library/4.0/RSAP'
Error: Failed to install 'RSAP' from GitHub:
(converted from warning) installation of package ‘C:/Users/AppData/Local/Temp/Rtmp6Fl8b5/file2478391ea47/RSAP_0.13.tar.gz’ had non-zero exit status

Installing R package ERROR: installing binary package failed

Complete newbie here, so there is probably something glaringly bad here. I created a Project following Hadley Wickham's book on R packages, and now I am trying add it to github for remote install (repository for reference).
Running devtools::install_github("alutterb/abcmlr") generated the following output:
Downloading GitHub repo alutterb/abcmlr#master
√ checking for file 'C:\Users\amlut\AppData\Local\Temp\RtmpMpn5uJ\remotes7146c405dd7\alutterb-abcmlr-918bf05/DESCRIPTION' ...
- preparing 'abcmlr':
√ checking DESCRIPTION meta-information ...
- checking for LF line-endings in source and make files and shell scripts
- checking for empty or unneeded directories
- building 'abcmlr_0.1.0.tar.gz'
Installing package into ‘C:/Users/amlut/Documents/R/win-library/3.5’
(as ‘lib’ is unspecified)
* installing *binary* package 'abcmlr' ...
cp: unknown option -- )
Try '/Rtools/bin/cp --help' for more information.
ERROR: installing binary package failed
* removing 'C:/Users/amlut/Documents/R/win-library/3.5/abcmlr'
In R CMD INSTALL
Error in i.p(...) :
(converted from warning) installation of package ‘C:/Users/amlut/AppData/Local/Temp/RtmpMpn5uJ/file71463953e7b/abcmlr_0.1.0.tar.gz’ had non-zero exit status
In my repository, I have a Linux executable that is to be used with wsl as well as an .exe file that is called in my R code. These may be the culprits, but I am not entirely sure. The error states that it failed to install the binary package, but install_github() takes a source package, so I am not sure what is going on. Any help is appreciated.
Thank you.
EDIT: This problem is solved. It was because of a line in my DESCRIPTION file that had to do with Built.
Check your %PATH% and type: where cp.
Another cp (like one from the Git for Windows distribution) might overshadow the RTools cp, which might explain the error message.
As commented by the OP hkj447, the error was trigger by a line in the DESCRIPTION file:
Built: R 3.5.3; ; 2019-06-14 21:17:43 UTC; windows
As seen in this thread:
You have a field called 'Built:' in your package's DESCRIPTION file;
R normally tries to inject that field itself when it builds your package from sources.
I deleted "Built"'s line in DESCRIPTION and then installed again.
This time, no error appeared.

R 'mvpart' package - any option to use in R 3.1.x?

I would like to use functions in the mvpart package in R. I know it has been removed from CRAN, but I tried installing archive versions available here: http://cran.r-project.org/web/packages/mvpart/index.html
install.packages("D:/mvpart_1.6-2.tar.gz", repos = NULL, type = "source")
I get this result:
Installing package into ‘C:/Users/jk/Documents/R/win-library/3.1’
(as ‘lib’ is unspecified)
* installing source package 'mvpart' ...
** package 'mvpart' successfully unpacked and MD5 sums checked
** libs
*** arch - i386
Warning: running command 'make -f "C:/PROGRA~1/R/R-31~1.3/etc/i386/Makeconf" -f "C:/PROGRA~1/R/R-31~1.3/share/make/winshlib.mk" SHLIB="mvpart.dll" OBJECTS="anova.o branch.o bsplit.o choose_surg.o dist.o fix_cp.o formatg.o free_tree.o gini.o graycode.o insert_split.o make_cp_list.o make_cp_table.o mrt.o mysort.o nodesplit.o partition.o poisson.o pred_rpart.o rpart.o rpart_callback.o rpartexp2.o rpcountup.o rpmatrix.o rundown.o rundown2.o s_to_rp.o s_xpred.o surrogate.o usersplit.o vgdist.o xdiss.o xval.o"' had status 127
ERROR: compilation failed for package 'mvpart'
* removing 'C:/Users/jk/Documents/R/win-library/3.1/mvpart'
Warning in install.packages :
running command '"C:/PROGRA~1/R/R-31~1.3/bin/x64/R" CMD INSTALL -l "C:\Users\jk\Documents\R\win-library\3.1" "D:/mvpart_1.6-2.tar.gz"' had status 1
Warning in install.packages :
installation of package ‘D:/mvpart_1.6-2.tar.gz’ had non-zero exit status
My questions are: Did I do something wrong here - is there a way to install 'mvpart'? Or, is there another package that will do multivariate partitioning, similar to 'mvpart'?
Option 1:
An archive install must be compiled, as it's stored as source code. Probably, you have not installed the R Tools compiler for Windows. Follow the install instructions here.
Once that was done, for me, mvpart installed flawlessly from the downloaded archive:
install.packages("C:/mydownload/path/mvpart_1.6-2.tar.gz", repos = NULL, type = "source")
Option 2:
If Option 1 doesn't get the job done, get the devtools package:
install.packages("devtools")
Use it to get the github version:
devtools::install_github("cran/mvpart")
I believe you'll still need the R tools compiler though
downloading Xcode from either the Apple AppStore or Apple Developer website solved my issues installing mvpart. The app version required iOS 10.13 as of this post, but it was easy to find a compatible older version on the website to download. After you download it, move it to your Applications folder and then open it. After that then the devtools:::install_github() worked for me.

Resources