Learn R Programming

RSurvey (version 0.7-4)

GetFile: Select a File to Open or Save As

Description

A GUI for selecting files to open or save.

Usage

GetFile(cmd = "Open", file = NULL, exts = NULL, initialdir = NULL,
        initialfile = NULL, defaultextension = NULL,
        win.title = cmd, multi = FALSE, parent = NULL)

Arguments

cmd
character; specifies if an "Open" or "Save As" file management pop up dialog box is implemented.
file
character; the file name which the data are to be read from. Alternatively, file can be a readable text-mode connection.
exts
character; a vector of default file extensions.
initialdir
character; specifies that the files in this directory should be displayed when the dialog pops up.
initialfile
character; the file name to be displayed in the dialog when it pops up.
defaultextension
character; the string that will be appended to the file name if the user enters a file name without an extension.
win.title
character; a string to display as the title of the dialog box.
multi
logical; if TRUE multiple files may be selected; its default is FALSE.
parent
tkwin; the GUI parent window.

Value

  • If multi is FALSE returns the file path as a charcter object with the following attributes:
  • directorycharacter; the directory that contains the file
  • namecharacter; the file name
  • extensioncharacter; the file extension
  • typecharacter; the file type
  • Otherwise, a list is returned containing a character object for each file.

Examples

Run this code
GetFile()

Run the code above in your browser using DataLab