list.files()

List the Files in a Directory/Folder

The

These functions produce a character vector of the names of files or directories in the named directory.

You can see further readings in the following link.

Usage
list.files(path = ".", pattern = NULL, all.files = FALSE,
           full.names = FALSE, recursive = FALSE,
           ignore.case = FALSE, include.dirs = FALSE, no.. = FALSE)

dir(path = ".", pattern = NULL, all.files = FALSE, full.names = FALSE, recursive = FALSE, ignore.case = FALSE, include.dirs = FALSE, no.. = FALSE)

list.dirs(path = ".", full.names = TRUE, recursive = TRUE)

Instruction

Copy and Run the sample code in your Rstudio to see how list.files() and list.dirs() function works.

DO NOT CLICK RUN

list.files() list.dirs()

Previous: 4-1 | Import files

Next: 4-3 | getwd()

Back to Main