[R] getting a function to do something

pdb philb at philbrierley.com
Sun Sep 19 00:44:53 CEST 2010


Hi,

I want to repeatedly do a task, so thought I could put it in a function and
then just call the function.
The task is just clearing all the graphics devices and then opening a new
one of a specified size.

Now, when I call the function below, nothing appears to happen. But when I
run the 2 lines in the function on there own, I get what I want.

Please can someone explain to me what is the obvious thing I am missing?

 clearG <- function() {
 graphics.off()
 windows(13,8)
}


#nothing happens (as far as I can tell)
clearG

#but this works, but I want to just type 1 line rather than several
 graphics.off()
 windows(13,8)




-- 
View this message in context: http://r.789695.n4.nabble.com/getting-a-function-to-do-something-tp2545594p2545594.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list