[R] Hiding a function

Christophe Genolini cgenolin at u-paris10.fr
Sat Feb 23 11:15:52 CET 2008


Hi the list

Is it possible to 'hide' a function  from the user ? I cut a big 
fonction in sub
function and I would like to hide the sub function, just like if I 
declare them
in the big function :

--------------
a <- function(x){
  b <- function(y){y^2}
  d <- function(y){y^3}
  b(x)+d(x)+2
}
a(2)
# [1] 14
b(2)
# Error :
----------------

I would like the same, but with external declaration (for readability) :

----------------
b <- function(y){y^2}
d <- function(y){y^3}
a <- function(x){
  b(x)+d(x)+2
}
a(2)
# [1] 14
b(2)
# Error
----------------

Is it possible ?

Thanks

Christophe



More information about the R-help mailing list