Re: [R] functions without arguments

2007-05-30 Thread Petr Klasterecky
Sure it is possible, but it is a very bad and possibly dangerous idea, since you may not control what's passed to your function. Consider this example: > x <- 1:5 > x [1] 1 2 3 4 5 > foo <- function(){mean(x)} > foo() [1] 3 > rm('x') > foo() Error in mean(x) : object "x" not found It is m

[R] functions without arguments

2007-05-30 Thread elyakhlifi mustapha
hello, I wanna know if it's possible to write functions without argument in order to understand that I write down an example f <- function(){ for (i in 1:length(C[[1]]) { print(10*C[[1]][i]) } } I know that there are errors in this syntax