How do I install X4R package on R? - r

I am trying to install X4R package to load a cube in R. There is a package with limited support to do this called 'X4R'. It can be found here:
https://www.linkedin.com/groupItem?view=&gid=77616&type=member&item=265568694&commentID=-1&trk=groups_guest_item_detail-b-jump_last#lastComment
and
https://github.com/overcoil/X4R
I have tried:
install.packages("devtools")
library(devtools)
install.packages("httr")
library(httr)
install.packages("Rcpp", lib="C:/Users/user1/Documents/R/win-library/3.1")
install_github("overcoil/X4R")
Since I am in a VM with no internet access, I used this line instead of last line in the above syntax:
install.packages("//tsclient/D/user1/R packages/X4R-master.zip", repos =NULL,lib="C:/Users/user1/Documents/R/win-library/3.1")
There is no error message displayed, but library didn't get installed.
So I tried this step:
install_local("//tsclient/D/user1/R packages/X4R-master.zip")
The above step produces same error posted in LinkedIn page:
g++ -m32 -I"C:/PROGRA~1/R/R-31~1.0/include" -DNDEBUG -I. -I"C:/Users/user1/Documents/R/win-library/3.1/Rcpp/include" -I"d:/RCompile/CRANpkg/extralibs64/local/include" -O2 -Wall -mtune=core2 -c soapXmlaWebServiceSoapProxy.cpp -o soapXmlaWebServiceSoapProxy
g++ -m32 -I"C:/PROGRA~1/R/R-31~1.0/include" -DNDEBUG -I. -I"C:/Users/user1/Documents/R/win-library/3.1/Rcpp/include" -I"d:/RCompile/CRANpkg/extralibs64/local/include" -O2 -Wall -mtune=core2 -c stdsoap2.cpp -o stdsoap2.o
stdsoap2.cpp:75:0: warning: ignoring #pragma comment [-Wunknown-pragmas]
stdsoap2.cpp:77:0: warning: ignoring #pragma warning [-Wunknown-pragmas]
stdsoap2.cpp: In function 'const char* soap_strerror(soap*)':
stdsoap2.cpp:16229:11: warning: variable 'len' set but not used [-Wunused-but-set-variable]
g++ -m32 -shared -s -static-libgcc -o X4R.dll tmp.def X4R.o soapC.o soapXmlaWebServiceSoapProxy.o stdsoap2.o -LC:/PROGRA~1/R/R-31~1.0/library/Rcpp/libs/i386 -LC:/PROGRA~1/R/R-31~1.0/library/Rcpp/libs/x64 -lRcpp -lws2_32 -Ld:/RCompile/CRANpkg/extralibs64/local/lib/i386 -Ld:/RCompile/CRANpkg/extralibs64/local/lib -LC:/PROGRA~1/R/R-31~1.0/bin/i386 -lR
c:/rtools/gcc-4.6.3/bin/../lib/gcc/i686-w64-mingw32/4.6.3/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lRcpp
collect2: ld returned 1 exit status
no DLL was created
ERROR: compilation failed for package 'X4R'
* removing 'C:/Users/user1/Documents/R/win-library/3.1/X4R'
Error: Command failed (1)
This is my sessionInfo().
sessionInfo()
R version 3.1.0 (2014-04-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
locale:
1 LC_COLLATE=English_Canada.1252 LC_CTYPE=English_Canada.1252 LC_MONETARY=English_Canada.1252
[4] LC_NUMERIC=C LC_TIME=English_Canada.1252
attached base packages:
1 stats graphics grDevices utils datasets methods base
other attached packages:
1 devtools_1.6
loaded via a namespace (and not attached):
1 tools_3.1.0
Looks like there are people successfully using this package. I would appreciate some help. Thank you in advance.

Related

To build an R package from source fails: Win10, RStudio

Installing a package from source fails for me on my windows machine. I uninstalled RStudio, R and deleted rtools40 folder, restarted and reinstalled those items. I believe I have the path set up appropriately.
Here's the code I tried, using some troubleshooting help from here:
#troubleshooting installation
pkgbuild::find_rtools()
pkgbuild::has_rtools(TRUE)
pkgbuild::check_rtools(TRUE)
pkgbuild::rtools_path()
pkgbuild::check_build_tools(TRUE)
pkgbuild::check_compiler(TRUE)
Sys.getenv("PATH")
Sys.getenv('BINPREF')
sessionInfo()
#Test installation from source via CRAN
pkgbuild::with_build_tools(install.packages("lme4", type = "source"))
And here is the output:
Restarting R session...
> #troubleshooting installation
> pkgbuild::find_rtools()
[1] TRUE
> pkgbuild::has_rtools(TRUE)
[1] TRUE
> pkgbuild::check_rtools(TRUE)
[1] TRUE
> pkgbuild::rtools_path()
[1] "C:\\rtools40/usr/bin"
> pkgbuild::check_build_tools(TRUE)
Your system is ready to build packages!
> pkgbuild::check_compiler(TRUE)
Trying to compile a simple C file
Running "C:/PROGRA~1/R/R-40~1.3/bin/x64/Rcmd.exe" SHLIB foo.c
Warning message:
In system(cmd) : 'make' not found
Error: Failed to compile C code
> Sys.getenv("PATH")
[1] "C:\\Program Files\\R\\R-4.0.3\\bin\\x64;C:\\rtools40\\bin;C:\\rtools40\\mingw64\\bin;C:\\Program Files (x86)\\Microsoft SDKs\\Azure\\CLI2\\wbin;C:\\Program Files (x86)\\Common Files\\Oracle\\Java\\javapath;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program Files\\Pandoc\\;C:\\Program Files\\Git\\cmd;C:\\Program Files\\dotnet\\;C:\\Program Files\\Microsoft SQL Server\\130\\Tools\\Binn\\;C:\\Program Files\\Microsoft SQL Server\\Client SDK\\ODBC\\170\\Tools\\Binn\\;C:\\Users\\nealm\\AppData\\Local\\Microsoft\\WindowsApps;C:\\ProgramData\\Anaconda3;C:\\ProgramData\\Anaconda3\\Scripts;C:\\Users\\nealm\\.conda\\pkgs\\conda-4.7.5-py37_0\\Scripts;C:\\ProgramData\\Anaconda3\\Library\\bin;C:\\Users\\nealm\\AppData\\Local\\GitHubDesktop\\bin;C:\\Users\\nealm\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Users\\nealm\\AppData\\Roaming\\TinyTeX\\bin\\win32;"
> Sys.getenv('BINPREF')
[1] "C:/rtools40/mingw64/bin/"
> sessionInfo()
R version 4.0.3 (2020-10-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19041)
Matrix products: default
locale:
[1] LC_COLLATE=English_New Zealand.1252 LC_CTYPE=English_New Zealand.1252 LC_MONETARY=English_New Zealand.1252
[4] LC_NUMERIC=C LC_TIME=English_New Zealand.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] processx_3.4.5 compiler_4.0.3 assertthat_0.2.1 R6_2.5.0 cli_2.2.0 livecode_0.1.0.9000
[7] prettyunits_1.1.1 tools_4.0.3 glue_1.4.2 rstudioapi_0.13 Rcpp_1.0.5 remotes_2.2.0
[13] crayon_1.3.4 fansi_0.4.1 callr_3.5.1 ps_1.4.0 pkgbuild_1.1.0
>
> #Test installation from source via CRAN
> pkgbuild::with_build_tools(install.packages("lme4", type = "source"))
Installing package into ‘C:/Rpackages’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/src/contrib/lme4_1.1-26.tar.gz'
Content type 'application/x-gzip' length 3297635 bytes (3.1 MB)
downloaded 3.1 MB
* installing *source* package 'lme4' ...
** package 'lme4' successfully unpacked and MD5 sums checked
** using staged installation
** libs
*** arch - i386
C:/rtools40/mingw64/bin/g++ -std=gnu++11 -I"C:/PROGRA~1/R/R-40~1.3/include" -DNDEBUG -I. -DNDEBUG -DEIGEN_DONT_VECTORIZE -I'C:/Rpackages/Rcpp/include' -I'C:/Rpackages/RcppEigen/include' -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c external.cpp -o external.o
C:/rtools40/mingw64/bin/g++ -std=gnu++11 -I"C:/PROGRA~1/R/R-40~1.3/include" -DNDEBUG -I. -DNDEBUG -DEIGEN_DONT_VECTORIZE -I'C:/Rpackages/Rcpp/include' -I'C:/Rpackages/RcppEigen/include' -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c glmFamily.cpp -o glmFamily.o
C:/rtools40/mingw64/bin/g++ -std=gnu++11 -I"C:/PROGRA~1/R/R-40~1.3/include" -DNDEBUG -I. -DNDEBUG -DEIGEN_DONT_VECTORIZE -I'C:/Rpackages/Rcpp/include' -I'C:/Rpackages/RcppEigen/include' -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c optimizer.cpp -o optimizer.o
C:/rtools40/mingw64/bin/g++ -std=gnu++11 -I"C:/PROGRA~1/R/R-40~1.3/include" -DNDEBUG -I. -DNDEBUG -DEIGEN_DONT_VECTORIZE -I'C:/Rpackages/Rcpp/include' -I'C:/Rpackages/RcppEigen/include' -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c predModule.cpp -o predModule.o
C:/rtools40/mingw64/bin/g++ -std=gnu++11 -I"C:/PROGRA~1/R/R-40~1.3/include" -DNDEBUG -I. -DNDEBUG -DEIGEN_DONT_VECTORIZE -I'C:/Rpackages/Rcpp/include' -I'C:/Rpackages/RcppEigen/include' -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c respModule.cpp -o respModule.o
C:/rtools40/mingw64/bin/g++ -std=gnu++11 -shared -s -static-libgcc -o lme4.dll tmp.def external.o glmFamily.o optimizer.o predModule.o respModule.o -LC:/PROGRA~1/R/R-40~1.3/bin/i386 -lR
C:/rtools40/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/PROGRA~1/R/R-40~1.3/bin/i386/R.dll when searching for -lR
C:/rtools40/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/PROGRA~1/R/R-40~1.3/bin/i386/R.dll when searching for -lR
C:/rtools40/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lR
collect2.exe: error: ld returned 1 exit status
no DLL was created
ERROR: compilation failed for package 'lme4'
* removing 'C:/Rpackages/lme4'
* restoring previous 'C:/Rpackages/lme4'
Warning in install.packages :
installation of package ‘lme4’ had non-zero exit status
The downloaded source packages are in
‘C:\Users\nealm\AppData\Local\Temp\RtmpwPwykm\downloaded_packages’
>
The problem does not appear to be specific to the lme4 package.
This is more of a work around than a proper answer. The alternative to installing and building from source is to install a pre-built binary. If one is not available, you can build it remotely.
In this case, for the package of interest for me, rundel/livecode on github, I:
Forked the repo (in this case rundel/livecode). This step might be optional.
Downloaded the tar.gz (remotes::install_github("markbneal/livecode") which doesn't install it, but the error tells you where it saves the .tar.gz file locally.
Used rhub to build the package binary for windows, go to this website https://builder.r-hub.io/ and upload your tar.gz file, ensuring rhub has your email address (click "advanced" button to provide your email address as alternate - you will need to validate it). That emails me a zip 5 minutes later.
Then copy the livecode folder in the zip that is emailed to me to my "R packages" folder location.
Package should now work for you, in my case library(livecode)
Edited six months later when I had to use this process again!

r package installation error "unknown type name ‘R_CallMethodDef’"

I'm trying to install r package "sparsesvd" using install.packages(), but got error during compilation. Any help is highly appreciated!
"unknown type name ‘R_CallMethodDef’"
I also tried conda install -c r r-sparsesvd; but got error.
Solving environment: failed
PackagesNotFoundError: The following packages are not available from
current channels:
r-sparsesvd
Current channels:
https://conda.anaconda.org/r/linux-64
https://conda.anaconda.org/r/noarch
https://conda.anaconda.org/bioconda/linux-64
https://conda.anaconda.org/bioconda/noarch
https://conda.anaconda.org/conda-forge/linux-64
https://conda.anaconda.org/conda-forge/noarch
https://repo.anaconda.com/pkgs/r/linux-64
https://repo.anaconda.com/pkgs/r/noarch
...
I tried
conda skeleton cran --recursive r-sparsesvd
conda build r-sparsesvd.
While the 1st step was successful, the build failed.
Execution halted
Tests failed for r-sparsesvd-0.1_4-r341h96ca727_0.tar.bz2
Here is the sessionInfo. Due to project reason, I have to use R3.3
R version 3.3.2 (2016-10-31) Platform: x86_64-pc-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)
locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C [3]
LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 [5]
LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 [7]
LC_PAPER=en_US.UTF-8 LC_NAME=C [9] LC_ADDRESS=C
LC_TELEPHONE=C [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages: [1] stats graphics grDevices utils
datasets methods base
loaded via a namespace (and not attached): [1] tools_3.3.2
This (once again) is not a problem with R, CRAN or its packages ...but apparently with Conda. On my system there is strictly no problem with this small package with very few dependencies:
R> install.packages("sparsesvd")
Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/sparsesvd_0.1-4.tar.gz'
Content type 'application/x-gzip' length 29729 bytes (29 KB)
==================================================
downloaded 29 KB
* installing *source* package ‘sparsesvd’ ...
** package ‘sparsesvd’ successfully unpacked and MD5 sums checked
** libs
gcc -I"/usr/share/R/include" -DNDEBUG -fpic -g -O3 -Wall -pipe -std=gnu99 -march=native -c las2.c -o las2.o
gcc -I"/usr/share/R/include" -DNDEBUG -fpic -g -O3 -Wall -pipe -std=gnu99 -march=native -c main.c -o main.o
gcc -I"/usr/share/R/include" -DNDEBUG -fpic -g -O3 -Wall -pipe -std=gnu99 -march=native -c svdlib.c -o svdlib.o
gcc -I"/usr/share/R/include" -DNDEBUG -fpic -g -O3 -Wall -pipe -std=gnu99 -march=native -c svdutil.c -o svdutil.o
svdutil.c: In function ‘svd_readBinFloat’:
svdutil.c:265:5: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
y = *((float *) &x);
^
svdutil.c: In function ‘svd_writeBinFloat’:
svdutil.c:290:3: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
int y = htonl(*((int *) &r));
^~~
gcc -Wl,-S -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o sparsesvd.so las2.o main.o svdlib.o svdutil.o -L/usr/lib/R/lib -lR
installing to /usr/local/lib/R/site-library/sparsesvd/libs
** R
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
* DONE (sparsesvd)
The downloaded source packages are in
‘/tmp/RtmpI3TPWj/downloaded_packages’
R>

Rfast installation: /usr/lib/R/etc/Makeconf:168: recipe for target 'Norm.o' failed

I am trying to install Rfast package. It gives me the following error,
/usr/lib/R/etc/Makeconf:168: recipe for target 'Norm.o' failed
make: *** [Norm.o] Error 1
Full error message is this,
> install.packages("Rfast", dependencies = TRUE)
* installing *source* package 'Rfast' ...
** package 'Rfast' successfully unpacked and MD5 sums checked
** libs
g++ -std=gnu++11 -I/usr/share/R/include -DNDEBUG -I"/home/haseeb/R/x86_64-pc-linux-gnu-library/3.4/Rcpp/include" -I"/home/haseeb/R/x86_64-pc-linux-gnu-library/3.4/RcppArmadillo/include" -fopenmp -fpic -g -O2 -fdebug-prefix-map=/build/r-base-AitvI6/r-base-3.4.4=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c Diag.cpp -o Diag.o
g++ -std=gnu++11 -I/usr/share/R/include -DNDEBUG -I"/home/haseeb/R/x86_64-pc-linux-gnu-library/3.4/Rcpp/include" -I"/home/haseeb/R/x86_64-pc-linux-gnu-library/3.4/RcppArmadillo/include" -fopenmp -fpic -g -O2 -fdebug-prefix-map=/build/r-base-AitvI6/r-base-3.4.4=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c Norm.cpp -o Norm.o
In file included from Norm.cpp:4:0:
templates.h: In function 'SEXPREC* eachrow_helper(SEXP, SEXP)':
templates.h:904:15: error: there are no arguments to 'DATAPTR' that depend on a template parameter, so a declaration of 'DATAPTR' must be available [-fpermissive]
T *xx=(T *) DATAPTR(x),*xend=xx+ncol*nrow,*yy=(T *) DATAPTR(y),yvalue,*x3;
^~~~~~~
templates.h:904:15: note: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)
templates.h:904:55: error: there are no arguments to 'DATAPTR' that depend on a template parameter, so a declaration of 'DATAPTR' must be available [-fpermissive]
T *xx=(T *) DATAPTR(x),*xend=xx+ncol*nrow,*yy=(T *) DATAPTR(y),yvalue,*x3;
^~~~~~~
templates.h:905:32: error: there are no arguments to 'DATAPTR' that depend on a template parameter, so a declaration of 'DATAPTR' must be available [-fpermissive]
RETURN_TYPE *m=(RETURN_TYPE*)DATAPTR(mat);
^~~~~~~
/usr/lib/R/etc/Makeconf:168: recipe for target 'Norm.o' failed
make: *** [Norm.o] Error 1
ERROR: compilation failed for package 'Rfast'
My sessioninfo is as follows,
> sessionInfo()
R version 3.4.4 (2018-03-15)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.1 LTS
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.7.1
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.7.1
locale:
[1] LC_CTYPE=C LC_NUMERIC=C LC_TIME=de_DE.UTF-8
[4] LC_COLLATE=C LC_MONETARY=de_DE.UTF-8 LC_MESSAGES=C
[7] LC_PAPER=de_DE.UTF-8 LC_NAME=C LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=de_DE.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_3.4.4 tools_3.4.4 yaml_2.2.0
Is there anyone who can help me fixing this issue?
I believe the problem is that I have forget to add
#include <Rinlinedfuns.h>
but I can not use this file. DATAPTR is declared in this file.
I have been getting the exact same error on my desktop and laptop running Ubuntu 16.04 and am at a loss how to fix this.
To me, it seems like a bad coding practice (use of the DATAPTR(x) function without prior declaration). I tried to find a declaration for DATAPTR in the header files but there is none to be found.
DATAPTR(x) is defined in /usr/share/R/include/Rinternals.h, which is not explicitly included in Norm.cpp, whereas it is included in Diag.cpp, the latter compiling without an error.
I don't know why this compiles in other machines and it fails only in ours. The g++ version is:
g++ (Ubuntu 5.4.0-6ubuntu1~16.04.10) 5.4.0 20160609
I would expect if Rinternals.h is not explicitly included wherever DATAPTR is needed then it should fail across all installations, unless somehow there is a way to instruct the compiler to include Rinternals.h by default?

R: Installing purrr from local returns error (fatal error: dplyr.h: No such file or directory)

UPDATE - Problem solved:
It seems like the way I set up .libPaths() (see comments below) loaded dplyr from a network directory, which somehow blocked the installation process of purrr. As soon as I installed and loaded dplyr from my local library I could install purrr.
I tried installing purrr from a local version of the package (purrr_0.2.2.tar.gz; see CRAN website). My installation attempt returns an error (fatal error: dplyr.h: No such file or directory):
> install.packages("H:/R_packages/purrr_0.2.2.tar.gz", # directory of the downloaded file
+ repos = NULL,
+ type = c("source"),
+ INSTALL_opts = "--no-test-load",
+ lib = "H:/R_packages") # where to install the package
'\\userhome\ABCD1234'
CMD.EXE was started with the above path as the current directory.
UNC paths are not supported. Defaulting to Windows directory.
* installing *source* package 'purrr' ...
** package 'purrr' successfully unpacked and MD5 sums checked
** libs
gcc -m64 -I"C:/R/R-3.2.1/include" -DNDEBUG -I../inst/include -DCOMPILING_DPLYR -I"H:/R_packages/Rcpp/include" -I"\\mypath//R/Lib/CRAN/3.2/dplyr/include" -I"H:/R_packages/BH/include" -I"d:/RCompile/r-compiling/local/local320/include" -O2 -Wall -std=gnu99 -mtune=core2 -c extract.c -o extract.o
g++ -m64 -I"C:/R/R-3.2.1/include" -DNDEBUG -I../inst/include -DCOMPILING_DPLYR -I"H:/R_packages/Rcpp/include" -I"\\mypath/R/Lib/CRAN/3.2/dplyr/include" -I"H:/R_packages/BH/include" -I"d:/RCompile/r-compiling/local/local320/include" -O2 -Wall -mtune=core2 -c fast-copy.cpp -o fast-copy.o
gcc -m64 -I"C:/R/R-3.2.1/include" -DNDEBUG -I../inst/include -DCOMPILING_DPLYR -I"H:/R_packages/Rcpp/include" -I"\\mypath/R/Lib/CRAN/3.2/dplyr/include" -I"H:/R_packages/BH/include" -I"d:/RCompile/r-compiling/local/local320/include" -O2 -Wall -std=gnu99 -mtune=core2 -c flatten.c -o flatten.o
gcc -m64 -I"C:/R/R-3.2.1/include" -DNDEBUG -I../inst/include -DCOMPILING_DPLYR -I"H:/R_packages/Rcpp/include" -I"\\mypath/R/Lib/CRAN/3.2/dplyr/include" -I"H:/R_packages/BH/include" -I"d:/RCompile/r-compiling/local/local320/include" -O2 -Wall -std=gnu99 -mtune=core2 -c map.c -o map.o
g++ -m64 -I"C:/R/R-3.2.1/include" -DNDEBUG -I../inst/include -DCOMPILING_DPLYR -I"H:/R_packages/Rcpp/include" -I"\\mypath/R/Lib/CRAN/3.2/dplyr/include" -I"H:/R_packages/BH/include" -I"d:/RCompile/r-compiling/local/local320/include" -O2 -Wall -mtune=core2 -c rows-data.cpp -o rows-data.o
rows-data.cpp:2:19: fatal error: dplyr.h: No such file or directory
compilation terminated.
make: *** [rows-data.o] Error 1
Warning: running command 'make -f "Makevars.win" -f "C:/R/R-3.2.1/etc/x64/Makeconf" -f "C:/R/R-3.2.1/share/make/winshlib.mk" SHLIB_LDFLAGS='$(SHLIB_CXXLDFLAGS)' SHLIB_LD='$(SHLIB_CXXLD)' SHLIB="purrr.dll" WIN=64 TCLBIN=64 OBJECTS="extract.o fast-copy.o flatten.o map.o rows-data.o rows-formatter.o rows.o transpose.o utils.o vector.o"' had status 2
ERROR: compilation failed for package 'purrr'
* removing 'H:/R_packages/purrr'
Warning in install.packages :
running command '"C:/R/R-3.2.1/bin/x64/R" CMD INSTALL --no-test-load -l "H:\R_packages" "H:/R_packages/purrr_0.2.2.tar.gz"' had status 1
Warning in install.packages :
installation of package ‘H:/R_packages/purrr_0.2.2.tar.gz’ had non-zero exit Status
I used the same approach for a lot of other packages (broom, modelr, forcats etc.), and it always worked. Does anybody have an idea why the package installation fails in this particular case?
> sessionInfo()
R version 3.2.1 (2015-06-18)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
locale:
[1] LC_COLLATE=German_Switzerland.1252 LC_CTYPE=German_Switzerland.1252 LC_MONETARY=German_Switzerland.1252
[4] LC_NUMERIC=C LC_TIME=German_Switzerland.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] dplyr_0.4.2
loaded via a namespace (and not attached):
[1] magrittr_1.5 R6_2.1.0 assertthat_0.1 parallel_3.2.1 DBI_0.3.1 tools_3.2.1 Rcpp_0.12.0

Cannot Install "tm" package in R macOS Sierra

When calling install.packages("tm") I get the following error:
> install.packages("tm")
Installing package into ‘/usr/local/lib/R/3.3/site-library’
(as ‘lib’ is unspecified)
trying URL 'https://ftp.cixug.es/CRAN/src/contrib/tm_0.7.tar.gz'
Content type 'application/x-gzip' length 526498 bytes (514 KB)
==================================================
downloaded 514 KB
* installing *source* package ‘tm’ ...
** package ‘tm’ successfully unpacked and MD5 sums checked
** libs
clang++ -I/usr/local/Cellar/r/3.3.2/R.framework/Resources/include -DNDEBUG -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -I/usr/local/include -I"/usr/local/lib/R/3.3/site-library/BH/include" -I"/usr/local/lib/R/3.3/site-library/Rcpp/include" -fPIC -g -O2 -c RcppExports.cpp -o RcppExports.o
clang -I/usr/local/Cellar/r/3.3.2/R.framework/Resources/include -DNDEBUG -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -I/usr/local/include -I"/usr/local/lib/R/3.3/site-library/BH/include" -I"/usr/local/lib/R/3.3/site-library/Rcpp/include" -fPIC -g -O2 -c copy.c -o copy.o
clang -I/usr/local/Cellar/r/3.3.2/R.framework/Resources/include -DNDEBUG -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -I/usr/local/include -I"/usr/local/lib/R/3.3/site-library/BH/include" -I"/usr/local/lib/R/3.3/site-library/Rcpp/include" -fPIC -g -O2 -c init.c -o init.o
clang++ -I/usr/local/Cellar/r/3.3.2/R.framework/Resources/include -DNDEBUG -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -I/usr/local/include -I"/usr/local/lib/R/3.3/site-library/BH/include" -I"/usr/local/lib/R/3.3/site-library/Rcpp/include" -fPIC -g -O2 -c tdm.cpp -o tdm.o
In file included from tdm.cpp:4:
/usr/local/lib/R/3.3/site-library/BH/include/boost/tokenizer.hpp:59:9: error: field of type 'std::__1::__wrap_iter<const char *>' has private constructor
: first_(c.begin()), last_(c.end()), f_() { }
^
tdm.cpp:25:28: note: in instantiation of function template specialization 'boost::tokenizer<boost::char_delimiters_separator<char, std::__1::char_traits<char> >, std::__1::__wrap_iter<const char *>, std::__1::basic_string<char> >::tokenizer<Rcpp::internal::const_string_proxy<16> >' requested here
boost::tokenizer<> tok(strings(index));
^
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/iterator:1239:31: note: declared private here
_LIBCPP_INLINE_VISIBILITY __wrap_iter(iterator_type __x) _NOEXCEPT : __i(__x) {}
^
In file included from tdm.cpp:4:
/usr/local/lib/R/3.3/site-library/BH/include/boost/tokenizer.hpp:59:28: error: field of type 'std::__1::__wrap_iter<const char *>' has private constructor
: first_(c.begin()), last_(c.end()), f_() { }
^
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/iterator:1239:31: note: declared private here
_LIBCPP_INLINE_VISIBILITY __wrap_iter(iterator_type __x) _NOEXCEPT : __i(__x) {}
^
2 errors generated.
make: *** [tdm.o] Error 1
ERROR: compilation failed for package ‘tm’
* removing ‘/usr/local/lib/R/3.3/site-library/tm’
Warning in install.packages :
installation of package ‘tm’ had non-zero exit status
The downloaded source packages are in
‘/private/var/folders/02/6mkk426d3jd46mg35j577bwc0000gn/T/RtmpHPgAoU/downloaded_packages’
My computer runs macOS Sierra. The output of sessionInfo() is:
R version 3.3.2 (2016-10-31)
Platform: x86_64-apple-darwin16.3.0 (64-bit)
Running under: macOS Sierra 10.12.3
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] tools_3.3.2
I didn't have problems installing "slam" as other posts mentioned. I have also tried installing "tm" with the dependencies flag set to TRUE but yields the same output. I installed R via homebrew. I wonder if there are any other steps I can try.
I've been having the same issue. For now, I've installed tm 0.6 from the cran.r-project website. This eliminated the compilation errors for me.

Resources