Hello everybody,

Let's consider the simple function:

f <- function(x = 1:10) {return(x)}

where the argument 'x' could take non integer values.

I would like to create such a function using Rcpp and roxygen2. If I try
something like:

//' @param x Vector of real values
NumericVector f(NumericVector x) {return(x);}

then after creation using devtools, I will obtain a function like this
one:
f <- function(x) {return(x)}

How can I write things in my C++ code so that I will obtain 
the x = 1:10 default values?

I tried something like:
 //' @param x Vector of real values
NumericVector f(NumericVector x = NumericVector::create(seq_len(10))
{return(x);}

but it failed completely ...

I am quite new to Rcpp, so I apologize if my question is too naive. If
this is the case, feel free to send me a web link to some documentation
that I could learn to try to solve this problem by myself.

Best regards,

Pierre

_______________________________________________
Rcpp-devel mailing list
Rcpp-devel@lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

Reply via email to