Make Secret Functions in package
To hide the source code of R functions in package, take the following steps:
-
Call
devtools::use_rcpp()
to initiate using Rcpp in package. -
Call
secret::use_secret()
to initiate using secret in package. -
Write anonymous functions in
./secret
.For example, create
./secret/test.R
:function(x) { x + 100 }
-
Call
secret::build_secret()
which converts all R scripts in./secret
to corresponding C++ source files in./src
. In the example,./secret/test.R
is converted to./src/test.cpp
. -
Build and distribute the package in binary format.