rcpp

rcpp function calling another rcpp function

*爱你&永不变心* 提交于 2020-08-17 19:59:13
问题 I'm guessing this is an easy question, but I'm new to Cpp, and am stuck. I've created a function in R, using Rcpp and: // [[Rcpp::export]] I can call the function in R and it works as intended. Let's call it F1 . Next, I want to create another function, F2 , using Rcpp which calls the first function. I use standard function call language (i.e., F1(arguments)) , and it compiles fine through R when I use sourceCpp() . But when I try to call F2 in R, I get: Error in .Primitive(".Call")( and F2

rcpp function calling another rcpp function

纵然是瞬间 提交于 2020-08-17 19:58:07
问题 I'm guessing this is an easy question, but I'm new to Cpp, and am stuck. I've created a function in R, using Rcpp and: // [[Rcpp::export]] I can call the function in R and it works as intended. Let's call it F1 . Next, I want to create another function, F2 , using Rcpp which calls the first function. I use standard function call language (i.e., F1(arguments)) , and it compiles fine through R when I use sourceCpp() . But when I try to call F2 in R, I get: Error in .Primitive(".Call")( and F2

rcpp function calling another rcpp function

邮差的信 提交于 2020-08-17 19:55:06
问题 I'm guessing this is an easy question, but I'm new to Cpp, and am stuck. I've created a function in R, using Rcpp and: // [[Rcpp::export]] I can call the function in R and it works as intended. Let's call it F1 . Next, I want to create another function, F2 , using Rcpp which calls the first function. I use standard function call language (i.e., F1(arguments)) , and it compiles fine through R when I use sourceCpp() . But when I try to call F2 in R, I get: Error in .Primitive(".Call")( and F2

dyn.load error linking a package with Rcpp

我们两清 提交于 2020-07-18 08:06:49
问题 I've made an R package with Rcpp, to use the methods of a library I programmed in c++. I've R running on the last version: R version 3.2.5 (2016-04-14) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 16.04 LTS I'm executing the following instruction to install my package: > install.packages("mypackage", repos = NULL) The package compiles well, I have the .o files of my source code, but in the linking phase I got the error: * installing *source* package ‘rbdd’ ... ** libs make: No

How to use a user-defined data C structure into an R package

删除回忆录丶 提交于 2020-07-09 11:24:13
问题 This minimal example compiles when I "source" the file: /* read_header.c */ #include <stdio.h> #include <stdlib.h> #include <RcppCommon.h> typedef struct { int my_data; } MY_HEADER_INFO; namespace Rcpp { template <> SEXP wrap(const MY_HEADER_INFO& x); } #include <Rcpp.h> namespace Rcpp { template <> SEXP wrap(const MY_HEADER_INFO& x) { std::vector<std::string> names; std::vector<SEXP> elements(1); // do something with the elements and names names.push_back("my_data"); elements[0] = Rcpp::wrap