title: Rcpp + inline - creating and calling additional functions
body: <p>I would like to know if there is a way to create <code>Rcpp</code> functions using the  <code>inline</code> packages within the main function. This is an example of what I want to do:</p>
  
  <pre><code>library(inline)
  library(Rcpp)
  a = 1:10
  cpp.fun = cxxfunction(signature(data1="numeric"), 
                        plugin="Rcpp",
                        body="
  int fun1( int a1)
  {int b1 = a1;
   b1 = b1*b1;
   return(b1);
  }
  
  NumericVector fun_data  = data1;
  int n = data1.size();
  for(i=0;i&lt;n;i++){
  fun_data[i] = fun1(fun_data[i]);
  }
  return(fun_data);
                             ")
  </code></pre>
  
  <p>which should result in:</p>
  
  <pre><code>&gt; cpp.fun(a)
  [1]  1  4  9  16  25  36  49  64  81  100
  </code></pre>
  
  <p>however I know that the compiler will not accept the creation of your own function within the main method. How will I go about creating and calling another <code>Rcpp</code> function with <code>inline</code> without having to pass it through to R?</p>