In response to your comment:
Actually, I would like to distribute it, but keeping the scripts and algorithm a secret, is there any way to encrypt this or any other way to achieve this?
You can (sort) do this by saving functions with save() . For example, here is the f() function that you want to keep secret:
f <- function(x, y) { return(x + y) }
Save it everywhere:
save(f, file = 'C:\\Users\\Joyce\\Documents\\R\\Secret.rda')
And if you want to use the function:
load("C:\\Users\\Joyce\\Documents\\R\\Secret.rda")
I would save all my functions in separate files, put them in a folder and have one simple old .R script, loading them all and doing anything. Zip it all up and distribute it to anyone. Maybe even compile it into a package. In fact, all this will be read-only.
This decision is not so great. You can still see the function in R by typing the name of the function so that it does not hide in that sense. But if you open .rda files, their contents will be distorted. It all depends on how experienced code recipients have R.
MadScone Dec 31 '13 at 9:52 2012-12-31 09:52
source share