Re: [R] How to hiding code for a package

From: Gabor Grothendieck <ggrothendieck_at_gmail.com>
Date: Sat 30 Jul 2005 - 22:21:45 EST

You could set the source attribute like this:

R> f <- function(x) x+1

R> # displays the word hidden instead of showing the source
R> attr(f, "source") <- "hidden"
R> f

hidden
R> f(10) # still works as a function properly [1] 11

Of course, someone knowledgable could change the source attribute back but this would prevent casual inspection.

On 7/30/05, Gary Wong <wongg62@pacbell.net> wrote:
> Hey everyone,
>
> I have made a package and wish to release it but
> before then I have a problem. I have a few functions
> in this package written in R that I wish to hide such
> that after installation, someone can use say the
> function >foo(parameters = "") but cannot do >foo.

> Typing foo should not show the source code or at least
> not all of it. Is there a way to do this ? I have
> searched the mailing list and used google, and have
> found something like "[R] Hiding internal package
> functions for the doc. pkg-internal.Rd" but this seems
> different since it seems that the keyword internal
> just hides the function from showing in the index and
> hides documentation, not the function itself. Can
> someone help? Thanks
>
> Gary
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Sat Jul 30 22:27:36 2005

This archive was generated by hypermail 2.1.8 : Sun 23 Oct 2005 - 14:59:46 EST