Skip to Content

Selecting a file with gWidgets

Below is an artificial example of a R widget created with the gWidgets package:

f <- function(file){
    dat <- read.table(file, header=TRUE)
lst <- list() 
    lst$action <- list(beginning="f(",ending=")")
    lst$arguments$file <- list(type="gfilebrowse")
ggenericwidget(lst, container=gwindow("Example"))

Using Windows there is a problem when browsing and selecting the file: the backslashes are not doubled in the file path. How to overcome this problem ? I don'y know how to replace the backslashes with double backslashes in a character string.