dlg_open {svDialogs} | R Documentation |
Modal dialog to select a file.
Description
Select an existing file, or create a new one.
Usage
dlg_open(
default = "",
title = if (multiple) "Select files" else "Select file",
multiple = FALSE,
filters = dlg_filters["All", ],
...,
gui = .GUI
)
dlgOpen(
default = "",
title = if (multiple) "Select files" else "Select file",
multiple = FALSE,
filters = dlg_filters["All", ],
...,
gui = .GUI
)
dlg_filters
dlgFilters
## S3 method for class 'gui'
dlg_open(
default,
title,
multiple = FALSE,
filters = dlg_filters["All", ],
...,
gui = .GUI
)
## S3 method for class 'textCLI'
dlg_open(
default,
title,
multiple = FALSE,
filters = dlg_filters["All", ],
...,
gui = .GUI
)
## S3 method for class 'nativeGUI'
dlg_open(
default,
title,
multiple = FALSE,
filters = dlg_filters["All", ],
rstudio = getOption("svDialogs.rstudio", TRUE),
...,
gui = .GUI
)
Arguments
default |
The default file to start with (use |
title |
A title to display on top of the dialog box. |
multiple |
Is a multiple selection of files allowed? |
filters |
A specification of file filters as a |
... |
Pass further arguments to methods. |
gui |
The 'gui' object concerned by this dialog box. |
rstudio |
Logical. Should 'RStudio' dialog boxes automatically be used
if available? If |
Format
An object of class matrix
(inherits from array
) with 22 rows and 2 columns.
An object of class matrix
(inherits from array
) with 22 rows and 2 columns.
Value
The modified 'gui' object is returned invisibly. The chosen file(s),
or an empty string if the "cancel" button was clicked is found in gui$res
(see example).
Note
On 'RStudio Server', multiple = TRUE
cannot be honored for now. So,
you can only select one file there, and a warning is issued to remind you
that. On 'RStudio Desktop', the OS-native dialog box is used instead in case
of multiple = TRUE
. Also, the textual version is painful to indicate
the full path of several files. So, it should use globbing, and/or indication
of a path followed by a selection in a list (to be done in further versions).
See Also
Examples
## Not run:
# Choose one R file
dlg_open(title = "Select one R file", filters = dlg_filters[c("R", "All"), ])$res
# Choose several files
dlg_open(multiple = TRUE)$res
## End(Not run)