This help topic is for R version 2.9.0. For the current version of R, try https://stat.ethz.ch/R-manual/R-patched/library/tcltk/html/tk_choose.files.html
tk_choose.files {tcltk}R Documentation

Choose a List of Files Interactively

Description

Use a Tk file dialog to choose a list of zero or more files interactively.

Usage

tk_choose.files(default = "", caption = "Select files",
                multi = TRUE, filters = NULL, index = 1)

Arguments

default

which filename to show initially.

caption

the caption on the file selection dialog.

multi

whether to allow multiple files to be selected.

filters

two-column character matrix of filename filters.

index

unused.

Details

Unlike file.choose, tk_choose.files will always attempt to return a character vector giving a list of files. If the user cancels the dialog, then zero files are returned, whereas file.choose would signal an error.

The format of filters can be seen from the example. File patterns are specified via extensions, with "*" meaning any file, and "" any file without an extension (a filename not containing a period). (Other forms may work on specific platforms.) Note that the way to have multiple extensions for one file type is to have multiple rows with the same name in the first column, and that whether the extensions are named in file chooser widget is platform-specific. The format may change before release.

Value

A character vector giving zero or more file paths.

See Also

file.choose, tk_choose.dir

Examples

Filters <- matrix(c("R code", ".R", "R code", ".s",
                    "Text", ".txt", "All files", "*"),
                  4, 2, byrow = TRUE)
Filters
if(interactive()) tk_choose.files(filter = Filters)

[Package tcltk version 2.9.0 ]