fileBrowser {tkWidgets} | R Documentation |
This function provides the widget for users to go up and down a path and
view the files. When files are selected and the "End"
button
is pressed, the function returns a vector of character strings with
the full paths of the selected files.
fileBrowser(path="", testFun = function(x) TRUE, prefix = NULL, suffix = NULL, textToShow = "Select file(s)", nSelect = -1)
path |
character string for the full path to be view. Defaults to the current working directory if no path is provided. |
testFun |
function that checks to see if a given file name satisfies predefined requirements. The default is no checking. |
prefix |
character string for a prefix used to screen out file names that do not have that prefix as part of their names. |
suffix |
character string for a suffix used to screen out file names that do not have that suffix as part of their names. |
textToShow |
character string to be shown on the widget to given instructions to users. |
nSelect |
integer indicating the number of files that should be
selected. No limitation if nSelect = -1 as per default. |
When a path is viewed, files will be displayed as they are and
directories will be displayed with a system file separator appended
(e.g. "/"
for Unix systems).
Single click on a file name will make the file selectable when the
select button is pressed. Multiple selection is possible by dragging
with mouse button 1 pressed.
Double click on a directory name will go into that directory and
display its files. When a file/directory is selected and the "End" button
pressed, the full path for the selected files selected will be
returned.
The widget is modal and has to be closed by pressing the "End" button
before doing any other operations. Functions, prefix, and suffix can
be specified. Examples of validity functions are
hasPrefix
and hasSuffix
.
The following is a list of the buttons and their associated behavior:
Up
Select \>\>
\<\< Remove
Clear
end
NULL
if the box is empty. The full path
will be appended to the file names.A vector of character strings containing the full path of each file selected.
This function is part of the Bioconductor project at Dana-Farber Cancer Institute to provide Bioinformatics functions using R.
Jianhua (John) Zhang
pickFiles
,
hasPrefix
, hasSuffix
## The example here is only run interactively since it requires user ## interference which may cause problems if not available: if(interactive()) { # Call the function to view the current directory flist <- fileBrowser() flist # To call the function with a path do # fileBrowser(path = "yourPath") }