What is the file.exists() function in R?
Overview
The function file.exists() returns a logical vector indicating whether the files named by its argument exist.
Syntax
file.exists(filename)
Syntax for the file.exists() function
Parameter value
This function takes the parameter value filename. This represents character vectors containing file names.
Return value
This function returns logical values (TRUE or FALSE) if the file exists or not.
Example
# creating a new filefile.create("ABC.txt")# renaming the file namefile.rename("ABC.txt", "XYZ.txt")# checking if the file existsfile.exists("XYZ.txt")