rcpp

    5熱度

    1回答

    我想端口SpecialK Poker Hand evaluator到R。我認爲這應該是相對容易使用Rcpp package,但我不知道從哪裏開始。 現有的教程似乎專注於開發新的C++代碼以便在R中使用。在這種情況下,我想在R中使用此代碼,並且最小麻煩。如果代碼是一個自包含的功能,我可以編譯和鏈接inline它的飛行,但是這並不在這裏工作。 我想這個問題有兩個部分: 我需要做的C++源代碼進行任何更

    0熱度

    1回答

    問題,我有以下程序。 #include <iostream> #include <vector> #include <algorithm> #include <cassert> #include <ctime> #include <cmath> #include <RInside.h> using std::cout; using std::endl; using std::ve

    -2熱度

    3回答

    我正在嘗試使用R進行預測,但每次下載預測軟件包時,都會顯示rcpp軟件包沒有正確安裝的錯誤。因此我無法運行預測。請你能告訴我什麼是錯的或我需要做什麼。

    3熱度

    2回答

    我試圖編譯SHLIB下面的函數(保存爲foo.cpp): #include <Rcpp.h> RcppExport SEXP foo(SEXP x, SEXP y){ Rcpp::NumericVector xx(x), yy(y) ; int n = xx.size() ; Rcpp::NumericVector res(n) ; double

    18熱度

    2回答

    我試圖在Rcpp函數中打開一個文件,所以我需要文件名作爲char *或std :: string。 到目前爲止,我已經試過如下: #include <Rcpp.h> #include <boost/algorithm/string.hpp> #include <fstream> #include <string> RcppExport SEXP readData(SEXP f1) {

    7熱度

    2回答

    我想從我的rcpp代碼中報告錯誤。我正在使用http://dirk.eddelbuettel.com/code/rcpp/html/classRcpp_1_1exception.html的構造函數exception (const char *message_, const char *file, int line)。爲了找出問題,我寫了下面bar.cpp: #include <Rcpp.h>

    12熱度

    3回答

    我想寫一些簡單的Rcpp代碼示例。使用Rcpp和inline軟件包這非常簡單。 但我難住了如何測試兩個字符元素是否相等。以下示例比較兩個字符向量的第一個元素。但我無法得到它編譯。 有什麼竅門? library(Rcpp) library(inline) cCode <- ' Rcpp::CharacterVector cx(x); Rcpp::CharacterVecto

    0熱度

    1回答

    我一直在Rcpp軟件包上進行一些測試,它的效果很好。 當從R傳遞一些CharacterVector到C++時,我有一點問題。 RcppExport SEXP testArray(SEXP Rarr){ Rcpp::CharacterVector cx(Rarr); Rcpp::LogicalVector r(1); std::string test = "a"

    3熱度

    1回答

    有誰知道如何使用Valgrind來內存調試RInside程序?

    4熱度

    2回答

    我想從Windows上的C++調用R函數。我使用MinGW來編譯程序,但它在編譯時會引發錯誤。均碼(從德克拍攝)和編譯錯誤如下: #include <iostream> using namespace std; #include "RInside.h" // for the embedded R via RInside Rcpp::NumericMatrix createMatrix(c