There isn't enough information here for me to be able to help. Try submitting a reproducible example: Welcome to the RStudio Community!
If not, then I think it may have to do with the path of your tif file. This blog post might help put that into perspective for you: Project-oriented workflow