I have an R script that takes a file as input, and I want a general way to know whether the input is a file that exists, and is not a directory.
In Python you would
There is a dir.exists function in all recent versions of R.
dir.exists
file.exists(f) && !dir.exists(f)