[R-gui] RGG help

Ilhami Visne ilhami.visne at gmail.com
Wed Sep 9 14:54:44 CEST 2009


Hello,

I'm the developer of RGG. In the docs there is a typo
accepted-extension. Actually it must be accepted-extensions (corrected
the docs). Please add an 's' to the end. Second, no point before
extension, write only RData.

Here is the corrected version of yours:

<rgg>
 #### First test of RGG. setwd and load .R file
 <filechooser label="Path:" var="path" accepted-extensions="RData"/>
 source("C:/Documents and Settings/p176435/My
Documents/gev_application/rgg_test01.R")
 dir = tstDir(path)
 setFun(path, dir = dir)
 if(!dir) load(path)
 getwd()
 ls()
</rgg>

i'll submit a patch so in the future accepted-extension will be accepted too.

Best wishes,
Ilhami Visne

On Wed, Aug 26, 2009 at 12:52 PM, Stefan
JansevanRensburg<Stefan.JansevanRensburg at resbank.co.za> wrote:
> ----------------------- *** Disclaimer *** -----------------------
> This e-mail and its contents are subject to the SA Reserve Bank's
> Disclaimer and Confidentiality Clause, which can be viewed at:
> http://www.reservebank.co.za/disclaimer
> Should you be unable to access the link provided, please send a
> blank e-mail to Disclaimer at resbank.co.za
> ----------------------- *** Disclaimer *** -----------------------
>
>
> Hi,
>
> Apart from experimenting with gWidgets, I'm also experimenting with RGG. Very impressed with it so far, especially considering it's pre-alpha status. I have, however, found that the accepted-extensions attribute of filechooser doesn't behave as expected. Despite setting accepted-extension=".RData", any file can still be selected.
>
> Here is the basic script I am busy with. It is meant to select the working directory and load the .RData file if that file is selected.
>
> Note that the R script is in a separate file, which the .rgg sourcing that file.
>
> RGG FILE:
>
> <rgg>
>  #### First test of RGG. setwd and load .R file
>  <filechooser label="Path:" var="path" accepted-extension=".RData"/>
>  source("C:/Documents and Settings/p176435/My Documents/gev_application/rgg_test01.R")
>  dir = tstDir(path)
>  setFun(path, dir = dir)
>  if(!dir) load(path)
>  getwd()
>  ls()
> </rgg>
>
> THE R SCRIPT rgg_test01.R:
>
> #### Function to paste togeth characters
> pCh <- function(ch){
>  x <- ""
>  for(i in ch){
>  x <- paste(x, i, sep = "")
>  }
>  return(x)
>  }
>
> #### Function to test if file or directory
> tstDir <- function(path){
>  lch <- unlist(strsplit(path, NULL))
>  sq <- seq(length(lch)-5, length(lch))
>  lch <- pCh(lch[sq])
>  print(lch)
>  dir <- ifelse(lch == ".RData", FALSE, TRUE)
>  return(dir)
>  }
>
> #### Function to set workspace and / or load prev session.
> setFun <- function(path, dir = TRUE){
>  ifelse(dir, setwd(path), setwd(dirname(path)))
>  }
>
> Any help or suggestions whatsoever, would be most appreciated.
>
> Kind regards,
>
>
>
>
> Stefan Janse van Rensburg
> Macroprudential Division
> Financial Stability Department
> SARB
> Tel : 012-313 4687
> Fax : 012 313 4772
>
>        [[alternative HTML version deleted]]
>
> _______________________________________________
> R-SIG-GUI mailing list
> R-SIG-GUI at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-gui
>



More information about the R-SIG-GUI mailing list