Lutz Prechelt
2006-May-18 14:00 UTC
[Rd] R CMD check: checking examples: how to (not) pause execution
Hello all, trying to prepare my first package for submission to CRAN I am stumbling over the "checking examples" step of R CMD check. I have some examples that produce more than one plot. I currently separate those plot calls by readline("Press <Return> for a plot including a density plot") or some such to have R wait before producing the next plot. This works OK for end users, but fails miserably during R CMD check, which appears to just eat the next line of the example source file for the input of readline (which took me quite a while to understand it). What is the right way to solve this problem? I can hardly believe that there is none (although the examples of 'plot' suggest exactly this: They run through multiple plots in a hurry.) I guess the appropriate approach would be if example() had some kind of single-stepping option? Any hints? Lutz Prechelt P.S.: Documentation remark: For users struggling with R CMD check it might be very helpful if R-exts.pdf contained some pointers to the functions or mechanisms used by R CMD check, or the names of source files where to find such information so they can better understand what is going on. Prof. Dr. Lutz Prechelt; prechelt at inf.fu-berlin.de Institut fuer Informatik; Freie Universitaet Berlin Takustr. 9; 14195 Berlin; Germany +49 30 838 75115; http://www.inf.fu-berlin.de/inst/ag-se/
Paul Gilbert
2006-May-18 14:29 UTC
[Rd] R CMD check: checking examples: how to (not) pause execution
I think the more usual way to solve this is to have the user set par(ask=TRUE) is they want to be prompted. This gives the user the option of being prompted, or not. It makes the example tests work, and simplifies your code because you don't need to worry about the prompt mechanism. It also potentially helps with multi-language support, etc, etc. Paul Lutz Prechelt wrote:>Hello all, > >trying to prepare my first package for submission to CRAN >I am stumbling over the "checking examples" step >of R CMD check. > >I have some examples that produce more than one plot. >I currently separate those plot calls by > readline("Press <Return> for a plot including a density plot") >or some such to have R wait before producing the next plot. > >This works OK for end users, but fails miserably >during R CMD check, which appears to just eat the >next line of the example source file for the input of readline >(which took me quite a while to understand it). > >What is the right way to solve this problem? > >I can hardly believe that there is none (although the >examples of 'plot' suggest exactly this: They run >through multiple plots in a hurry.) > >I guess the appropriate approach would be if >example() had some kind of single-stepping option? > >Any hints? > > Lutz Prechelt > >P.S.: >Documentation remark: >For users struggling with R CMD check it might be >very helpful if R-exts.pdf contained some pointers >to the functions or mechanisms used by R CMD check, >or the names of source files where to find such information >so they can better understand what is going on. > >Prof. Dr. Lutz Prechelt; prechelt at inf.fu-berlin.de >Institut fuer Informatik; Freie Universitaet Berlin >Takustr. 9; 14195 Berlin; Germany >+49 30 838 75115; http://www.inf.fu-berlin.de/inst/ag-se/ > >______________________________________________ >R-devel at r-project.org mailing list >https://stat.ethz.ch/mailman/listinfo/r-devel > >-------------- next part -------------- =================================================================================== La version fran?aise suit le texte anglais. ------------------------------------------------------------------------------------ This email may contain privileged and/or confidential inform...{{dropped}}