Re: [R] More on global environment

From: Uwe Ligges <ligges_at_statistik.uni-dortmund.de>
Date: Fri 16 Jul 2004 - 16:45:48 EST

Mike Prager wrote:

> At 7/15/2004 03:23 PM Thursday, Andy Liaw wrote:
>

>> I've posted the following to R-help before.  Hope it helps you.
>>
>> cd <- function(dir = tclvalue(tkchooseDirectory()), saveOld=FALSE,
>>                loadNew=TRUE) {
>>     stopifnot(require(tcltk))

>
>
> flush.console()

What you want in a general function is

   if(.Platform$OS.type == "windows")

       flush.console()

Since flush.console() does not exist in any other version than the Windows versions of R.

Uwe Ligges

>>     if (saveOld) save.image(compress=TRUE)
>>     setwd(dir)
>>     rm(list=ls(all=TRUE, envir=.GlobalEnv), envir=.GlobalEnv)
>>     if (loadNew && file.exists(".RData")) {
>>         loaded <- load(".RData", envir=.GlobalEnv)
>>         return(invisible(loaded))
>>     }
>> }
>>
>> [The tcltk part is based on Prof. Fox's help.]
>>
>> Andy

>
>
> Thanks! It's lovely. I added the call to flush.console() as shown,
> which (under Windows RGUI at least) issues the message that tcl is
> loading in a more timely way.
>
> Mike
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html


R-help@stat.math.ethz.ch mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Fri Jul 16 16:55:41 2004

This archive was generated by hypermail 2.1.8 : Wed 03 Nov 2004 - 22:55:00 EST