@Dirk: I didn’t want to overwhelm those on the list with tons of code. Below is
the full source for the function. What else would you need to see?
After clearing my environment variables, I am now getting the following error:
Error in logit(30, 0, 100) :
function 'enterRNGScope' not provided by package 'Rcpp'
I do have some roxygen documentation errors in my package? Might this have an
effect in producing the error?
Here is the function:
// [[Rcpp::export]]
Rcpp::NumericVector logit(Rcpp::NumericVector x,
Rcpp::NumericVector xMin,
Rcpp::NumericVector xMax,
double adjustment = 0.3) {
int N = x.length();
int nMin = xMin.length();
int nMax = xMax.length();
Rcpp::NumericVector logOgive(N,0.0);
if(!(nMin == 1 || nMin == N))
return logOgive;
if(!(nMax == 1 || nMax == N))
return logOgive;
if(xMin.length() != xMax.length())
return logOgive;
int justOne;
if(xMin.length() == 1)
justOne = 1;
else
justOne = 0;
NumericVector upperBound = xMax - adjustment;
NumericVector lowerBound = xMin + adjustment;
for(int i = 0; i < N; i++) {
if(x[i] < 0) continue;
if(justOne == 1) {
if(x[i] <= xMin[0]) x[i] = lowerBound[i];
if(x[i] >= xMax[0]) x[i] = upperBound[i];
logOgive[i] = log((x[i] - xMin[0])/(xMax[0] - x[i]));
} else {
if(x[i] <= xMin[i]) x[i] = lowerBound[i];
if(x[i] >= xMax[i]) x[i] = upperBound[i];
logOgive[i] = log((x[i] - xMin[i])/(xMax[i] - x[i]));
}
}
return logOgive;
}
Barth
_______________________________________________
Rcpp-devel mailing list
[email protected]
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel