I'm quite new to programming with Rcpp so I'm trying out new things to see how everything works. I wrote a small programm to compare two NumericVectors with the match() function. I also wanted to print out the input Vectors and the Output but it doesn't seem to work since I don't get the entries of the Vectors back but the storage place (or something like that). I haven't found any kind of "print" function for NumericVectors but maybe there's another way? Any help will be appreciated.
This is my code:
#include <Rcpp.h>
using namespace Rcpp;
using namespace std;
// [[Rcpp::export]]
IntegerVector vergl(NumericVector eins, NumericVector zwei){
IntegerVector out = match(eins, zwei);
cout << eins << endl;
cout << zwei << endl;
cout << match(eins, zwei) << endl;
return out;
}
A small example:
vergl(c(1,2,3),c(2,3,4))
The output:
> vergl(c(1,2,3),c(2,3,4))
0xa1923c0
0xa192408
0xb6d7038
[1] NA 1 2
Thank you.