Unable to load and read raster files

I am getting the following error while trying to read the raster file.

Error in .local(.Object, ...) :

Error in .rasterObjectFromFile(x, band = band, objecttype = "RasterLayer", :
Cannot create a RasterLayer object from this file. (file does not exist)

Here is my code:
install.packages("raster")
install.packages("rgdal")
install.packages("sp")

library(raster)
library(sp)
library(rgdal)

ELEVATION <- raster("/Cloud/project/ll/DEM.tif")

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

Directory names on RStudio Cloud are case-sensitive. Try this:

raster("/cloud/project/ll/DEM.tif")
2 Likes

Thank you very much. It worked.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.