[ESS] par(ask=T) in ESS

Christophe Pallier christophe.pallier at gmail.com
Tue Oct 3 13:33:50 CEST 2006


2006/10/3, Stephen Eglen <S.J.Eglen at damtp.cam.ac.uk>:
> Dear Christophe,
> Thanks for providing the example code!  (Although it just needs
> something like "t <- 1:100" to work)
>
>  > Here is an example code:
>  >
>  > sig1 <- ts(sin(2*pi*t/100),frequency=10)
>  > sig2 <- ts(sin(2*pi*t/50),frequency=10)
>  >
>  > s1 <- spectrum(sig1,plot=FALSE)
>  > s2 <- spectrum(sig2,plot=FALSE)
>  >
>  > z1 <- fft(sig1)
>  > z2 <- fft(sig2)
>  >
>  > par(mfrow=c(2,2),ask=F)
>  > plot(sig1,type='l',col='red')
>  > plot(s1$freq,s1$spec,log='x')
>  > plot(sig2,type='l',col='blue')
>  > plot(s2$freq,s2$spec,log='x')
>  >
>  > par(mfrow=c(2,2),ask=T)
>  > plot(sig1,type='l',col='red')
>  > plot(abs(z1))
>  > plot(sig2,type='l',col='blue')
>  > plot(abs(z2))
>  >
>  >
>  > Is there any way to make par(ask=T) work under ESS? Or is it a bad
>  > idea to expect interaction between the *R* process while it is
>  > evaluating a region?
>
> Yes, right now this is a problem.  I can't think of an immediate way
> around this - Ctrl G may help you out here.
>
>
>  > Actually, I need to use 'par(ask=T)' because I am trying to avoid
>  > opening new windows for each graphics because this is not portable
>  > (x11() for linux does not work when I send my code to my colleagues
>  > using Windows').
>
> I wonder if you could write a function, something like new.window()
> that would check getOption("device") to then launch the appropriate
> new window?

Thanks! This pointed me toward the right direction:
I just discovered that this was documented at the end of the help page
of "Devices"

get(getOption("device"))()

Best,

Christophe




More information about the ESS-help mailing list