This is my first stack question, so please be kind guys!
I really liked my recently found power to build R packages using devtools. However, as soon as I try to create a package that uses RcppArmadillo, my workflow with running devtools :: document (), devtools :: check () and devtools :: build () no longer works.
For example, I have (I hope, quite minimal + full) a test version of the package that I am trying to create here: https://github.com/suztolwinskiward/fooR/ . fooR contains only one function, which is an implementation of the rdist.earth function from C ++ from the field package.
Running devtools :: document ("fooR") spills out a lot of messages (several referring to "undefined references" to variables that do not live in my original ko, which are not interpreted to me, and then are not executed:
collect2: ld returned 1 exit status no DLL was created ERROR: compilation failed for package 'fooR' * removing 'C:/Users/I53794/AppData/Local/Temp/RtmpWgC8nD/devtools_install_1ea473123086/fooR' Error: Command failed (1)
On the other hand, when I start from a C ++ function that depends on RcppArmadillo, it seems to work fine:
> Rcpp::sourceCpp('./src/rdist_earth_cpp.cpp') > data('miami') > data('new_orleans','katrina_path') > rdist_earth_cpp(katrina_path,new_orleans) [,1] [1,] 1042.36073 [2,] 998.96793 [3,] 957.69315 [4,] 917.91486 [5,] 868.07791 [6,] 805.73485 [7,] 763.01476 [8,] 726.10133 [9,] 692.14482 [10,] 670.15133 [11,] 662.23353 [12,] 625.55592 [13,] 601.08682 [14,] 579.73940 [15,] 560.32660 [16,] 539.14192 [17,] 510.15438 [18,] 481.40037 [19,] 442.52322 [20,] 391.96619 [21,] 331.66378 [22,] 271.79088 [23,] 201.24749 [24,] 128.12647 [25,] 56.99198 [26,] 45.80297 [27,] 32.96609 [28,] 81.71237 [29,] 189.31050 [30,] 296.92104 [31,] 406.12593 [32,] 516.08458 [33,] 654.81113 [34,] 808.21670
It makes me think that something is wrong with the way I try to use RcppArmadillo in my package, but I could not understand what. Any advice is greatly appreciated!
PS I am surprised that there is no RcppArmadillo tag.