SAP NetWeaver & R - 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

Related

Cannot devtools::install_github() with R 3.6.1

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!

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.

Compile R package "arulesSequence" for older release

I want to use arulessequences for sequence mining. I have to use it in Oracle R distribution version R 3.3.0 (last released) and The problem is that the last version of the arulesSequences package is R >= 3.3.2. So I get an error for this problem:
Error: this is R 3.3.0, package arulesSequences needs >=3.3.2
So I decided to compile the source code for older release. I downloaded an older package that needs R 3.2.5 or above. And I know that this package is depended to arules. so I have installed it already. I used following instructions to compile the arulessequences package:
in the source directory I run this command:
R CMD build arulesSequences
the output of this command is:
c:\rr\arulesSequences_0.2-17>R CMD build arulesSequences
* checking for file 'arulesSequences/DESCRIPTION' ... OK
* preparing 'arulesSequences':
* checking DESCRIPTION meta-information ... OK
* cleaning src Warning in cleanup_pkg(pkgdir, Log) : unable to run 'make clean' in 'src'
* checking for LF line-endings in source and make files
* checking for empty or unneeded directories
* looking to see if a 'data/datalist' file should be added
* building 'arulesSequences_0.2-17.tar.gz'
a file named 'arulesSequences_0.2-17.tar.gz' get created but when I check it as below I get the following as output:
c:\rr\arulesSequences_0.2-17\arulesSequences>R CMD check arulesSequences
* using log directory 'c:/rr/arulesSequences_0.2-17/arulesSequences/arulesSequences.Rcheck'
using R version 3.4.0 (2017-04-21)
using platform: x86_64-w64-mingw32 (64-bit)
using session charset: ISO8859-1
checking for file 'arulesSequences/DESCRIPTION' ... OK
this is package 'arulesSequences' version '0.2-17'
checking package namespace information ... OK
checking package dependencies ... ERROR Package required but not available: 'arules'
See section 'The DESCRIPTION file' in the 'Writing R Extensions'
manual.
* DONE Status: 1 ERROR
I know the arules package is installed and I checked it. It seems the build process is not successful. do you have any idea to help solve this out?
You have to first install c/c++ compiler for R(called gcc) that is under R's additional build tools.
to do that, in RStudio goto File->New File ->c++ File.
It will show the following dialogue:
Then click on yes.
to compile a package under windows, you have to set repo to Null and type to source.
you can use this command to do that:
install.packages("SOURCEADDRESS",type="source",repo=null)
as #EugèneAdell mentioned above you have to first install arules. then arulessequences.
Instead of building, take the archive packages that seem to be ok for your R version and install them. On my Linux, this gives :
wget http://cran.univ-paris1.fr/src/contrib/Archive/arules/arules_1.5-0.tar.gz
R CMD INSTALL $HOME/arules_1.5-0.tar.gz
* installing to library ‘/home/ruser/R-3.2.5/lib64/R/library’
* installing *source* package ‘arules’ ...
...
** testing if installed package can be loaded
* DONE (arules)
wget http://cran.univ-paris1.fr/src/contrib/Archive/arulesSequences/arulesSequences_0.2-17.tar.gz
R CMD INSTALL $HOME/arulesSequences_0.2-17.tar.gz
* installing to library ‘/home/ruser/R-3.2.5/lib64/R/library’
* installing *source* package ‘arulesSequences’ ...
...
** testing if installed package can be loaded
* DONE (arulesSequences)
R
> library(arulesSequences)
Loading required package: arules
Loading required package: Matrix
Attaching package: ‘arules’
Maybe a more recent version for arules is possible, I just took the first one from the 1.5 series.

install package on windows ERROR: compilation failed for package 'cldr'

url <- "http://cran.us.r-project.org/src/contrib/Archive/cldr/cldr_1.1.0.tar.gz"
pkgFile<-"cldr_1.1.0.tar.gz"
download.file(url = url, destfile = pkgFile)
Console
>trying URL 'http://cran.us.r-project.org/src/contrib/Archive/cldr/cldr_1.1.0.tar.gz'
Content type 'application/x-gzip' length 2296083 bytes (2.2 MB)
==============================
downloaded 2.2 MB
install.packages(pkgs = pkgFile, type = "source", repos = NULL)
> Installing package into ‘C: / Users / v - xuawan / Documents / R / win -
library / 3.2’
(as ‘lib’ is unspecified)
* installing * source * package 'cldr' ...
** package 'cldr' successfully unpacked and MD5 sums checked
** libs
> ** * arch - i386
Warning:running command 'make -f "Makevars" -f "C:/PROGRA~1/R/R-32~1.0/etc/i386/Makeconf" -f "C:/PROGRA~1/R/R-32~1.0/share/make/winshlib.mk" SHLIB_LDFLAGS='$(SHLIB_CXXLDFLAGS)' SHLIB_LD='$(SHLIB_CXXLD)' SHLIB="cldr.dll" ' had status 127
ERROR:compilation failed for package 'cldr'
* removing 'C:/Users/v-xuawan/Documents/R/win-library/3.2/cldr'
Warning in install.packages:running command '"C:/PROGRA~1/R/R-32~1.0/bin/x64/R" CMD INSTALL -l "C:\Users\v-xuawan\Documents\R\win-library\3.2" "cldr_1.1.0.tar.gz"' had status 1
Warning in install.packages:installation of package ‘cldr_1.1.0.tar.gz’ had non -
zero exit status
I tried to install package cldr on windows.
I am wondering if any of you know how to solve above error message
Have you installed RTools?
Choose the right version, which belongs to your R version (it seems you use R 3.2)
From the 127 return code, it looks like you don't have a C++ compiler installed on your path. Have you installed the latest Rtools for Windows? It will give you the C++ toolchain you need.
Try this: install.packages("cldr", type="binary"). I was getting same error message for 'backports' package installation.
The same functions can be found in other packages now available on CRAN. They can be installed with the usual install.packages("cld2") and install.packages("cld3"):
cld2 - https://github.com/ropensci/cld2
cld3 - https://github.com/ropensci/cld3
For a quick comparison based on tweets, see this other answer: https://stackoverflow.com/a/46663823/4124601
I was having the same issue on R Cloud for 'raster' package, it's fixed when I've switched to Desktop R Studio. I've seen Desktop R studio downloads other required packages too before installing the one you wanted. I'm not sure if this's the exact case for you, but worth to try!

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