rcpp

Can't install package reshape2 for R 2.15.3 on Ubuntu 12.04.4

大城市里の小女人 提交于 2019-12-24 06:37:48
问题 I am having trouble installing the reshape2 package for R 2.15.3 on Ubuntu 12.04.4 LTS. I decided not to upgrade to R 3.x because many of the packages that I use have not been upgraded to support the new version. When I try to install reshape2 using R 2.15.3 on Ubuntu 12.04.4 LTS, I get the following. > install.packages("reshape2") Installing package(s) into â/usr/local/lib/R/site-libraryâ (as âlibâ is unspecified) Warning in install.packages("reshape2") : 'lib = "/usr/local/lib/R/site

Is accessing/setting elements in a Rcpp::List thread safe?

≯℡__Kan透↙ 提交于 2019-12-24 06:33:40
问题 I want to perform what is effectively a parallel lapply inside Rcpp on a list of lists, effectively taking/removing elements from a list and computing with them. Basically doing what Rcpp parallel does but with lists instead of numeric vectors. In Rcpp is getting/setting a list element thread safe if done by numeric index? Pseudo code for the type of thing I want to do below: List original = // created somewhere else, List results = List(original.size()); // Is this function thread safe? auto

RInside example build using clang++ on OS X Mavericks cannot find STL standard library on linking

你。 提交于 2019-12-24 04:28:07
问题 I recently moved to C++11 and Xcode 5 with command line tools on OS X 10.9.1, installed boost 1.55 using Homebrew and changed the compiler from g++ to clang++ (as mentioned in this post: Error when with Xcode 5.0 and Rcpp). The compiler change fixed Rcpp when running in R. But I am having issues with compiling the RInside examples (which used to work just fine). I re-downloaded RInside and unzipped the tar, went to the examples/standard directory and did a make clean and make all . It looks

RInside on Mac OS X

北战南征 提交于 2019-12-24 04:22:11
问题 I have R 3.0.3 installed with mac ports on OS X 10.9.2. I installed RInside with sudo R CMD INSTALL ~/Downloads/RInside_0.2.11.tgz (similarly Rcpp_0.11.1.tar). I am trying to compile a simple RInside Help World code from http://dirk.eddelbuettel.com/code/rinside.html. I am trying to use g++ main.cpp -I/Users/robogos/Library/R/3.0/library/RInside/include/ -I/Users/robogos/Library/R/3.0/library/Rcpp/include/ -I/opt/local/Library/Frameworks/R.framework/Versions/3.0/Resources/include/ and I get a

RInside on Mac OS X

天大地大妈咪最大 提交于 2019-12-24 04:21:09
问题 I have R 3.0.3 installed with mac ports on OS X 10.9.2. I installed RInside with sudo R CMD INSTALL ~/Downloads/RInside_0.2.11.tgz (similarly Rcpp_0.11.1.tar). I am trying to compile a simple RInside Help World code from http://dirk.eddelbuettel.com/code/rinside.html. I am trying to use g++ main.cpp -I/Users/robogos/Library/R/3.0/library/RInside/include/ -I/Users/robogos/Library/R/3.0/library/Rcpp/include/ -I/opt/local/Library/Frameworks/R.framework/Versions/3.0/Resources/include/ and I get a

unordered_map in a function argument

匆匆过客 提交于 2019-12-24 03:59:12
问题 Question Why does using std::unordered_map as a function argument fail to compile (and how do I solve it)? Example This first function has the std::unordered_map as a function parameter, but fails to compile library(Rcpp) cppFunction( code = 'void test( std::unordered_map< std::string, std::string > um ) { }' , plugins = "cpp11" ) Whereas it's fine when declared in the body of the function cppFunction( code = 'void test( ) { std::unordered_map< std::string, std::string > um; }' , plugins =

Collapse vectors in Rcpp

核能气质少年 提交于 2019-12-24 02:06:37
问题 I have an Rcpp function that gives me as result an list with some vectors of strings (std::vector). [[1]] [1] "0" "1" "0" "0" "0" "0" [[2]] [1] "0" "0" "0" "0" "0" "1" [[3]] [1] "0" "1" "0" "0" "0" "0" [[4]] [1] "0" "0" "0" "1" "0" "0" I want to get these things like this: [[1]] [1] "010000" [[2]] [1] "000001" [[3]] [1] "010000" [[4]] [1] "000100" Now I am using: apply(do.call(rbind,myFunctioninCPP(),1,paste0,collapse="") to get what I want. I'm wondering if its possible to get this more

RcppArmadillo + bigmemory crashes Windows RStudio (but no other GUI + OS.type)

我们两清 提交于 2019-12-24 00:57:10
问题 I'm working on an R package, bigKRLS. bigKRLS works on Windows RGui but encounters a fatal error on Windows RStudio. Some details... Windows RGui works but Windows RStudio encounters a fatal error; confirmed on four different machines using R 3.3.0, 3.3.1, 3.3.3; RTools 3.3 and 3.4 following the best practices recommended by the Coatless Professor; RStudio 1.0.136; Windows 7 and 8. Presently, bigKRLS works on RStudio for Mac OS X Yosemite and Ubuntu 14.04 without issue. bigKRLS depends on

dmvnorm MVN density - RcppArmadillo implementation slower than R package including a bit of Fortran

旧城冷巷雨未停 提交于 2019-12-24 00:43:01
问题 The solution is now online in the Rcpp Gallery I re-implemented dmvnorm from the mvtnorm package in RcppArmadillo. I somehow like Armadillo, but I guess it would also work in plain Rcpp. The approach from dmvnorm is based on the mahalanobis distance, so I have a function for that and then the multivariate normal density function. Let me show you my code: #include <RcppArmadillo.h> #include <Rcpp.h> // [[Rcpp::depends("RcppArmadillo")]] // [[Rcpp::export]] arma::vec mahalanobis_arma( arma::mat

caught segfault, memory not mapped error in Rcpp trying to implement a function

元气小坏坏 提交于 2019-12-23 22:08:28
问题 i'm new in Rcpp and i dont really know Rcpp. but as a personal project, i was trying to run some sort algorithms using some C code that i had, converting them to R with Rcpp. But i'm getting the memory not mapped error, and i dont really understand what i'm doing wrong, so if someone could enlighten me :) The problem happens when a try the following code #include <Rcpp.h> using namespace Rcpp; void intercala(int p, int q, int r, NumericVector v) { int i, j, k; NumericVector w = NumericVector: