[R] getGraphicsEvent plotting two graph

From: <cgenolin_at_u-paris10.fr>
Date: Sun, 13 Apr 2008 14:48:35 +0200


Hi the list,

I need to use getGraphicsEvent to plot two graph. On the following toy example:
- the function b is ploting two graph depending on a parameter - the function a is calling b according to some user answers. It is suppose to call b until the user press Return, but it does not.

b <- function(x){

    dev.off(2);dev.off(3)
    windows();windows(3,3,xpos=0)
    dev.set(2);plot(1:x)
    dev.set(3);plot(1:x^2)

    return(NULL)
}

b(2)

a <- function(y){

    b(y)
    getGraphicsEvent("Arrow Up or Return",

        onKeybd=function(key){
            if(key!="ctrl-J"){
                if(key=="Up"){y <<- y+1}else{}
                b(y)
                cat("\n*** This function a never gets here... ***\n")
                return(NULL)
            }else{
                return(TRUE)
            }
        }

    )
}

a(3)

Is there something wrong in my code, or something I did not understand in getGraphicsEvent ?
I try on R 2.2.1, then on R 2.7

Thanks for your help.

Christophe



Ce message a ete envoye par IMP, grace a l'Universite Paris 10 Nanterre

R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Sun 13 Apr 2008 - 12:54:44 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 14 Apr 2008 - 20:31:37 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive