file.exists()
and dir.exists()
get_help()
docs
The file.exists()
and dir.exists()
functions come with R
and are part of the Base R
{base}
package.
We use these functions to determine whether a given file (file.exists()
) or directory aka folder (dir.exists()
) exists. These functions return either TRUE
or FALSE
and are useful for double-checking if your paths are correct.
file.exists("path/to/file/you/want/to/know/exists.txt")
dir.exists("path/to/directory/you/want/to/know/exists/")