I'm guessing this is an easy question but I'm new to using CPP in R. I created an cpp function in a cpp file in R, say mean(a, b) using #include <Rcpp.h> and // [[Rcpp::export]] and sourceCpp to use that function in the rest of my R script. This works fine. I am trying to also use that function in another Cpp function file. It seems to be possible using #include <mean.h> but I don't understand the logic/way of doing that. How do I have to change my mean function script to have this work if this is possible ?
#include <Rcpp.h>
using namespace Rcpp;
// [[Rcpp::export]]
Rcpp::double mean(int a, int b)
{
double mean = 0;
mean = (a+b)/2;
return mean
}
Thanks a lot for the help