Unless the file is not in the current working directory, it won't be found, even if it is in a subdirectory.
Install and load the here
library. Create an Rproj file if one is not already present in the working directory.
Relative to the working directory provide the calling function with the relative pathname. Assuming that the file is in an immediate subdirectory of the working directory call img
, use
here("img/name_of_file.png")
as the argument to any function seeking the file.