If you want to hide some code from accidental or casual sight then I have had 
some success with adding something like this to the .R file for a package (the 
petals function in TeachingDemos in this case):

.onAttach <- function(...) {
    petals <- petals
    attr(petals,'source') <- "Don't Cheat!"
    assign('petals',petals,'package:TeachingDemos')
}

Though that would only slow an experienced R programmer down by maybe 10 
seconds if they really wanted to see the code, it might take an intermediate 
level R programmer a whole minute to figure out how to work around this.  But 
it would prevent an honest user that knew of a license or agreement to not look 
at the code from accidentally seeing what they agreed not to.

You could also include something in the code that checked the attribute and 
stopped working if it was changed or somehow notified you of the change.  
Combining this with the license agreements as others have said might give you 
additional recourse.

You can see the petals.R file in the TeachingDemos package on R-forge for 
another example of obfuscating (bleaching) a key piece of code.  Combining the 
2 might slow down an expert by a whole 30 seconds, but at least they would not 
be able to claim that they accidentally saw the code.

Whether this violates the spirit of R licensing or not is another issue.

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111


> -----Original Message-----
> From: r-devel-boun...@r-project.org [mailto:r-devel-bounces@r-
> project.org] On Behalf Of A Zege
> Sent: Tuesday, October 11, 2011 11:09 AM
> To: r-devel@r-project.org
> Subject: Re: [Rd] how to make a true binary package?
> 
> OK, gentlemen, i agree with you in general. I was not talking about a
> general
> purpose, general use package that one prepares for CRAN. I am sure you
> are
> familiar professionally or can imagine situations where you need to
> demonstrate a solution to a specific task without fully disclosing the
> details -- sometimes even hard core open source adherents need to
> sacrifice
> desire for openness for some prosaic purposes, like getting paid :).
> Compilable languages give an easy solution of a binary code. It sounds
> like
> if one wants true binary, he has to recode in C++. I thought it's
> possible
> in R as well, i thought this was discussed even as a default behavior
> for
> next version of R to make stuff go faster. Maybe not. Thanks, anyway.
> 
> 
> --
> View this message in context: http://r.789695.n4.nabble.com/how-to-
> make-a-true-binary-package-tp3895117p3895262.html
> Sent from the R devel mailing list archive at Nabble.com.
> 
> ______________________________________________
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to