gui.file.choose {utilitiesR}R Documentation

cross-platform file selection interface

Description

This is a cross-platform function to allow the user to choose a file interactively. If graphics=TRUE, choose.files is used on Windows (file dialog), and tcltk::tk_choose.files otherwise (& if supported), and an interactive text interface if all else fails.

Usage

  gui.file.choose(startDir = getwd(),
    title = "Choose file(s)", multi = FALSE, filter = NULL,
    graphics = TRUE)

Arguments

startDir

start directory (default current directory)

title

title for dialog

filter

a 2-column matrix with file description & filter in each column, with multiple filters for a single file type being separated by semicolons (doesn't work in text interface yet).

multi

whether to allow selection of multiple items

graphics

whether to present a graphics interface (if possible)

Value

the file(s) chosen (character vector). If is.empty is TRUE, the user selected 'Cancel'.

See Also

Other ui: dir.browse, file.browse, Filters, gui.dir.choose, gui.menu, gui.readline, gui.yesno, tk_entry.dialog, tk_select.list

Examples

## Not run: 
# choose .R or .q files (or All files):
fList <- gui.file.choose(filter=matrix(c('R files','*.q;*.R',
                                         'All files','*.*'),
                                         ncol=2, byrow=T))

## End(Not run)

[Package utilitiesR version 1.8.2 Index]