[R] Quiz {was "Quit asking me .."}

Deepayan Sarkar deepayan at stat.wisc.edu
Wed Sep 17 09:17:24 CEST 2003


On Wednesday 17 September 2003 01:36, Martin Maechler wrote:

> How can you write (quite short!) R code such that
> typing
> 	"Q"
>
> -- without any  "()" -- will quit R (without asking about saving).
>
> [But you shouldn't really keep that code active in your standard R session
>  because it would be too easy to accidentally shut down R !]
>
> For the advanced ones:
> My shortest solution uses 51 characters of R code, can you beat that?

Barely, 46 removing all spaces:

print.q<-function(x)q("no");Q<-1;class(Q)<-"q"

We can also replace <- by = in recent (and _ in older) versions of R to 
decrease this further.




More information about the R-help mailing list