Sorry for the cross-post. Not sure where the problem is... A while back I posted an R function to R-help: cd <- function (dir = tclvalue(tkchooseDirectory()), saveOld = FALSE, loadNew = TRUE) { stopifnot(require(tcltk)) 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)) } where the default value for the `dir' argument is to run the tcltk directory chooser and get the directory name chosen. (Thanks to Prof. John Fox for the tcltk part!!) While this function works fine under Rgui on Windows, it doesn't work when running R within ESS (5.2.3) and XEmacs (21.4.13). The directory chooser never shows up, and dir just gets the empty string. Does anyone have any idea what could be the problem? I'd very much appreciate any pointers. Best, Andy
Dear Andy, Perhaps it's possible, but I've never been able to get tcltk to work properly under ESS/Xemacs on Windows. Regards, John> -----Original Message----- > From: ess-help-bounces at stat.math.ethz.ch > [mailto:ess-help-bounces at stat.math.ethz.ch] On Behalf Of Liaw, Andy > Sent: Friday, September 24, 2004 3:03 PM > To: r-help at stat.math.ethz.ch; ESS (Help list) > Subject: using tcltk in R under ESS/XEmacs on Windows > > Sorry for the cross-post. Not sure where the problem is... > > A while back I posted an R function to R-help: > > cd <- function (dir = tclvalue(tkchooseDirectory()), saveOld = FALSE, > loadNew = TRUE) { > stopifnot(require(tcltk)) > 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)) > } > > where the default value for the `dir' argument is to run the > tcltk directory chooser and get the directory name chosen. > (Thanks to Prof. John Fox for the tcltk part!!) While this > function works fine under Rgui on Windows, it doesn't work > when running R within ESS (5.2.3) and XEmacs (21.4.13). The > directory chooser never shows up, and dir just gets the empty > string. Does anyone have any idea what could be the problem? > I'd very much appreciate any pointers. > > Best, > Andy > > ______________________________________________ > ESS-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/ess-help
On Fri, 2004-09-24 at 15:02, Liaw, Andy wrote:> Sorry for the cross-post. Not sure where the problem is... > > A while back I posted an R function to R-help: > > cd <- function (dir = tclvalue(tkchooseDirectory()), saveOld = FALSE, > loadNew = TRUE) { > stopifnot(require(tcltk)) > 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)) > } > > where the default value for the `dir' argument is to run the tcltk directory > chooser and get the directory name chosen. (Thanks to Prof. John Fox for > the tcltk part!!) While this function works fine under Rgui on Windows, it > doesn't work when running R within ESS (5.2.3) and XEmacs (21.4.13). The > directory chooser never shows up, and dir just gets the empty string. Does > anyone have any idea what could be the problem? I'd very much appreciate > any pointers. > > Best, > AndyAndy, This works under FC2 using ESS 5.2.3 with XEmacs version 21.4.15, so presumably there is something specific to the Windows implementation? Also, two things: 1. You are missing a closing brace above, which I presume may be a simple copy and paste issue. 2. If you successfully change the directory, the cd() function itself is deleted from the global environment via your rm(...), as you currently have it implemented. I am not sure if this is intentional or not. HTH, Marc
Dear Andy, I've taken the liberty of copying this reply to the r-help and ess-help lists since my last reply was misleading. I believe that the problem with tkchooseDirectory() (you can see it by just calling that function directly) is that it brings up a native Windows dialog, and it's that kind of tcltk command that I've had trouble with in ESS/XEmacs under Windows. Regards, John> -----Original Message----- > From: Liaw, Andy [mailto:andy_liaw at merck.com] > Sent: Friday, September 24, 2004 3:23 PM > To: 'John Fox' > Subject: RE: using tcltk in R under ESS/XEmacs on Windows > > Hi John, > > demo(tkfaq) did work for me. Maybe that's the exception... > > Thanks! > Andy > > > From: John Fox > > > > Dear Andy, > > > > Perhaps it's possible, but I've never been able to get > tcltk to work > > properly under ESS/Xemacs on Windows. > > > > Regards, > > John > > > > > -----Original Message----- > > > From: ess-help-bounces at stat.math.ethz.ch > > > [mailto:ess-help-bounces at stat.math.ethz.ch] On Behalf Of > Liaw, Andy > > > Sent: Friday, September 24, 2004 3:03 PM > > > To: r-help at stat.math.ethz.ch; ESS (Help list) > > > Subject: using tcltk in R under ESS/XEmacs on Windows > > > > > > Sorry for the cross-post. Not sure where the problem is... > > > > > > A while back I posted an R function to R-help: > > > > > > cd <- function (dir = tclvalue(tkchooseDirectory()), > > saveOld = FALSE, > > > loadNew = TRUE) { > > > stopifnot(require(tcltk)) > > > 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)) > > > } > > > > > > where the default value for the `dir' argument is to run > the tcltk > > > directory chooser and get the directory name chosen. > > > (Thanks to Prof. John Fox for the tcltk part!!) While > this function > > > works fine under Rgui on Windows, it doesn't work when running R > > > within ESS (5.2.3) and XEmacs (21.4.13). The directory chooser > > > never shows up, and dir just gets the empty string. Does anyone > > > have any idea what could be the problem? > > > I'd very much appreciate any pointers. > > > > > > Best, > > > Andy > > > > > > ______________________________________________ > > > ESS-help at stat.math.ethz.ch mailing list > > > https://stat.ethz.ch/mailman/listinfo/ess-help > > > > > > > > > -------------------------------------------------------------- > ---------------- > Notice: This e-mail message, together with any attachments, > contains information of Merck & Co., Inc. (One Merck Drive, > Whitehouse Station, New Jersey, USA 08889), and/or its > affiliates (which may be known outside the United States as > Merck Frosst, Merck Sharp & Dohme or MSD and in Japan, as > Banyu) that may be confidential, proprietary copyrighted > and/or legally privileged. It is intended solely for the use > of the individual or entity named on this message. If you > are not the intended recipient, and have received this > message in error, please notify us immediately by reply > e-mail and then delete it from your system. > -------------------------------------------------------------- > ----------------
> From: Marc Schwartz > > On Fri, 2004-09-24 at 15:02, Liaw, Andy wrote: > > Sorry for the cross-post. Not sure where the problem is... > > > > A while back I posted an R function to R-help: > > > > cd <- function (dir = tclvalue(tkchooseDirectory()), > saveOld = FALSE, > > loadNew = TRUE) { > > stopifnot(require(tcltk)) > > 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)) > > } > > > > where the default value for the `dir' argument is to run > the tcltk directory > > chooser and get the directory name chosen. (Thanks to > Prof. John Fox for > > the tcltk part!!) While this function works fine under > Rgui on Windows, it > > doesn't work when running R within ESS (5.2.3) and XEmacs > (21.4.13). The > > directory chooser never shows up, and dir just gets the > empty string. Does > > anyone have any idea what could be the problem? I'd very > much appreciate > > any pointers. > > > > Best, > > Andy > > Andy, > > This works under FC2 using ESS 5.2.3 with XEmacs version 21.4.15, so > presumably there is something specific to the Windows implementation?Given Prof. Fox's follow-up and your obvservation, I guess the problem _is_ Windows-specific. 8-(> Also, two things: > > 1. You are missing a closing brace above, which I presume may be a > simple copy and paste issue.Yes. My apologies.> 2. If you successfully change the directory, the cd() > function itself is > deleted from the global environment via your rm(...), as you currently > have it implemented. I am not sure if this is intentional or not.Well, sort of. I've placed it in a small package along with other handy stuff, so that won't be a problem. Best, Andy> HTH, > > Marc > > > >
Tony: It is indeed most amazing that you have been able to get ESS/Emacs running under Windows. And much appreciated by those of us who have to moil around with MessySoft machines. Thanks to all who have contributed to the effort. Cheers, Shawn Boles -----Original Message----- From: A.J. Rossini [mailto:blindglobe at gmail.com] Sent: Saturday, September 25, 2004 8:04 PM To: Liaw, Andy Cc: R-Help; MSchwartz at MedAnalytics.com; ESS (Help list) Subject: Re: [R] using tcltk in R under ESS/XEmacs on Windows It most likely is Windows specific. It's most amazing that we actually have ESS/(X)Emacs working under windows in the first place. Unfortunately, I'm in transit for the next few weeks, but I'll probably have a windows machine on my desk sometime after that. Argh. best, -tony On Fri, 24 Sep 2004 17:48:18 -0400, Liaw, Andy <andy_liaw at merck.com> wrote:> > From: Marc Schwartz > > > > On Fri, 2004-09-24 at 15:02, Liaw, Andy wrote: > > > Sorry for the cross-post. Not sure where the problem is... > > > > > > A while back I posted an R function to R-help: > > > > > > cd <- function (dir = tclvalue(tkchooseDirectory()), > > saveOld = FALSE, > > > loadNew = TRUE) { > > > stopifnot(require(tcltk)) > > > 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)) > > > } > > > > > > where the default value for the `dir' argument is to run > > the tcltk directory > > > chooser and get the directory name chosen. (Thanks to > > Prof. John Fox for > > > the tcltk part!!) While this function works fine under > > Rgui on Windows, it > > > doesn't work when running R within ESS (5.2.3) and XEmacs > > (21.4.13). The > > > directory chooser never shows up, and dir just gets the > > empty string. Does > > > anyone have any idea what could be the problem? I'd very > > much appreciate > > > any pointers. > > > > > > Best, > > > Andy > > > > Andy, > > > > This works under FC2 using ESS 5.2.3 with XEmacs version 21.4.15, so > > presumably there is something specific to the Windowsimplementation?> > Given Prof. Fox's follow-up and your obvservation, I guess the problem_is_> Windows-specific. 8-( > > > Also, two things: > > > > 1. You are missing a closing brace above, which I presume may be a > > simple copy and paste issue. > > Yes. My apologies. > > > 2. If you successfully change the directory, the cd() > > function itself is > > deleted from the global environment via your rm(...), as youcurrently> > have it implemented. I am not sure if this is intentional or not. > > Well, sort of. I've placed it in a small package along with otherhandy> stuff, so that won't be a problem. > > Best, > Andy > > > > > HTH, > > > > Marc > > > > > > > > > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide!http://www.R-project.org/posting-guide.html>-- A.J. Rossini blindglobe at gmail.com ______________________________________________ ESS-help at stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/ess-help
Apparently Analagous Threads
- how to get the GUI directory chooser on Windows?
- More on global environment
- PLEASE IGNORE PREVIOUS: How to configure ess-5.2.0beta3-1.i586.rpm, Xemacs and SuSE 9.0?
- How to configure ess-5.2.0beta3-1.i586.rpm, Xemacs and SuSE 9.0?
- Sweave and Xemacs on Windows2000?