R: Choose a Folder Interactively on MS Windows

choose.dir {utils} | R Documentation

## Choose a Folder Interactively on MS Windows

### Description

Use a Windows shell folder widget to choose a folder interactively.

### Usage

    choose.dir(default = "", caption = "Select folder")

### Arguments

`default` | which folder to show initially.
`caption` | the caption on the selection dialog.

### Details

This brings up the Windows shell folder selection widget. With the default `default = ""`, ‘My Computer’ (or similar) is initially selected.

To workaround a bug, on Vista and later only folders under ‘Computer’ are accessible via the widget.

### Value

A length-one character vector, character `NA` if ‘Cancel’ was selected.

### Note

This is only available on Windows.

### See Also

`choose.files` (on Windows) and `file.choose` (on all platforms).

### Examples

      if (interactive() && .Platform$OS.type == "windows")
            choose.dir(getwd(), "Choose a suitable folder")

[Package utils version 4.0.5 Index]