This thread Reprojecting raster from lat/lon to UTM in R? was of no help to me.
I have the following raster which I first need to create in lat/long in order to crop it to rworldmap. However, I then need to work in UTM. How do I convert the raster to UTM? The above thread just assigns the UTM projection from the start, which I know how to do. I just don't know how to convert back.
# Make raster layer of study area
ras = raster(ext=extent(-70, -55, -60, -38), res=c(0.01,0.01))
#give all ponints a "1"
ras[] <- 1
#project the grid to lat/long
projection(ras) <- "+proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0"
# load land
library(rworldmap)
worldMap <- getMap(resolution = "high")
projection(worldMap) <- CRS(proj4string(ras))
#crop and mask raster by land
r2 <- crop(ras, worldMap)
r3 <- mask(r2, worldMap, inverse = T)
plot(r3)
#convert raster back to UTM
....??