我的要求是使用R来分析来自我公司SAP系统的数据。我在本地计算机上使用R v.3.2.4,并且能够通过SAPGUI登录SAP。
我发现要将R连接到SAP需要RSAP软件包,要安装它,您需要在本地计算机上安装SAP NetWeaver RFC SDK。
我尝试了以下步骤,但坚持在R中安装RSAP(步骤12)。
如果有任何建议,我将不胜感激......
根据以下步骤: https://wiki.scn.sap.com/wiki/display/ABAPConn/Download+and+Installation+of+NW+RFC+SDK
01] Download NWRFC_38-20004568.SAR
02] Download SAPCAR.exe
03] Put both files in the same directory C:\Downloads
04] Run 'cmd' to open command terminal window and change directory to C:\Downloads
05] To decompress the .SAR file write in the command line SAPCAR_617-80000938.exe -xvf NWRFC_38-20004568.SAR
步骤依据:在https://github.com/piersharding/RSAP上安装文件
06] Position header and library directories as C:\nwrfcsdk\include and C:\nwrfcsdk\lib - move directory nwrfcsdk from C:\Downloads to C:\
07] Copy the content of C:\nwrfcsdk\lib into the Windows system32 directory ie: C:\Windows\System32
08] Download Rtools for appropriate version of R from cran.r-project.org
09] Run the downloaded file RTools33.exe to install Rtools (see installation settings at the very bottom)
10] Then reboot the computer. You must make absolutely sure that the RTools install worked correctly - check for any errors when you startup R
11] In R install packages 'devtools', 'yaml', 'reshape' (last two are dependencies for RSAP) and restart R
12] In R execute:
library(devtools)
library(yaml)
library(reshape)
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"))
以下是错误:
Downloading GitHub repo piersharding/RSAP@master from URL h t t p s ://api.github.com/repos/piersharding/RSAP/zipball/master
Error in curl::curl_fetch_memory(url, handle = handle) :
Problem with the SSL CA cert (path? access rights?)
In addition: Warning message:
Username parameter is deprecated. Please use piersharding/RSAP
我按照INSTALL文件中的建议尝试了另一件事:
12] In R execute:
install.packages("RSAP", repos=c("h t t p://piersharding.com/R"), type="source")
这次系统做了一些工作,但仍然没有成功:
Installing package into ‘\\RWAMSEEFP1/U_kosinskr$/My Documents/R/win-library/3.2’
(as ‘lib’ is unspecified)
Warning in install.packages :
dependencies ‘yaml’, ‘reshape’ are not available
trying URL 'http://piersharding.com/R/src/contrib/RSAP_0.9.tar.gz'
Content type 'application/x-gzip' length 69780 bytes (68 KB)
downloaded 68 KB
* installing *source* package 'RSAP' ...
** libs
Warning: this package has a non-empty 'configure.win' file,
so building only the main architecture
gcc -m64 -I"C:/PROGRA~1/R/R-32~1.4/include" -DNDEBUG -I. -I"C:/nwrfcsdk/include" -DSAPwithUNICODE -DUNICODE -D_UNICODE -D_AFXDLL -D_CRT_NON_CONFORMING_SWPRINTFS -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -DSAPonNT -DSAP_PLATFORM_MAKENAME=ntintel -I"d:/RCompile/r-compiling/local/local323/include" -O2 -Wall -std=gnu99 -mtune=core2 -c RSAP.c -o RSAP.o
In file included from C:/nwrfcsdk/include/sapnwrfc.h:7:0,
from RSAP.c:41:
C:/nwrfcsdk/include/sapucx.h:562:5: warning: 'align' attribute directive ignored [-Wattributes]
In file included from RSAP.c:41:0:
C:/nwrfcsdk/include/sapnwrfc.h:28:0: warning: ignoring #pragma warning [-Wunknown-pragmas]
RSAP.c: In function 'u8to16c':
RSAP.c:133:12: warning: variable 'rc' set but not used [-Wunused-but-set-variable]
RSAP.c: In function 'u8to16':
RSAP.c:150:12: warning: variable 'rc' set but not used [-Wunused-but-set-variable]
RSAP.c: In function 'u8to16r':
RSAP.c:167:12: warning: variable 'rc' set but not used [-Wunused-but-set-variable]
RSAP.c: In function 'u16to8c':
RSAP.c:184:12: warning: variable 'rc' set but not used [-Wunused-but-set-variable]
RSAP.c: In function 'u16to8':
RSAP.c:208:12: warning: variable 'rc' set but not used [-Wunused-but-set-variable]
RSAP.c: At top level:
C:/nwrfcsdk/include/sapuc.h:853:24: warning: 'sccsidU16' defined but not used [-Wunused-variable]
gcc -m64 -shared -s -static-libgcc -o RSAP.dll tmp.def RSAP.o -L. -LC:/nwrfcsdk/lib -lsapnwrfc -llibsapucum -Ld:/RCompile/r-compiling/local/local323/lib/x64 -Ld:/RCompile/r-compiling/local/local323/lib -LC:/PROGRA~1/R/R-32~1.4/bin/x64 -lR
installing to \\RWAMSEEFP1/U_kosinskr$/My Documents/R/win-library/3.2/RSAP/libs/x64
** R
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
Warning in library(pkg_name, lib.loc = lib, character.only = TRUE, logical.return = TRUE) :
there is no package called 'RSAP'
Error: loading failed
Execution halted
ERROR: loading failed
* removing '\\RWAMSEEFP1/U_kosinskr$/My Documents/R/win-library/3.2/RSAP'
Warning in install.packages :
running command '"C:/PROGRA~1/R/R-32~1.4/bin/x64/R" CMD INSTALL -l "\\RWAMSEEFP1\U_kosinskr$\My Documents\R\win-library\3.2" C:\Users\kosinskr\AppData\Local\Temp\Rtmp40cQJZ/downloaded_packages/RSAP_0.9.tar.gz' had status 1
Warning in install.packages :
installation of package ‘RSAP’ had non-zero exit status
The downloaded source packages are in
‘C:\Users\kosinskr\AppData\Local\Temp\Rtmp40cQJZ\downloaded_packages’
RTools安装设置
目的地位置:c:\Rtools
设置类型:Package authoring installation
选定的组件:
R toolset
Cygwin DLLs
R 2.15.x-R 3.2.x toolchain
R 3.3.x+ 32 bit toolchain
R 3.3.x+ 64 bit toolchain
其他任务:
Change system PATH to:
PATH=c:\Rtools\bin;c:\Rtools\gcc-4.6.3\bin;C:\Program Files (x86)\Java\jre6\bin;C:\Program Files\Java\jre6\bin;C:\Windows\system32;
[truncated]
Save version information to registry