I am using sf
package version 0.9-6. I define a new object in ESRI:4326 and then try to reproject it to an Albers projection. I get an error, despite explicitly setting the crs when defining the object.
Here is MWE.
library(sf)
# Linking to GEOS 3.8.1, GDAL 3.1.4, PROJ 6.3.1
disp_win_wgs84 <- sf::st_sf(st_sfc(st_point(c(-97.2, 32.55)),
st_point(c(-85.55, 49.2)),
crs = 4326))
target_crs <- 102003
disp_win_trans <- sf::st_transform(disp_win_wgs84, crs = target_crs)
I get the following error:
Error in CPL_transform(x, crs, aoi, pipeline, reverse) :
crs not found: is it missing?
In addition: Warning message:
In CPL_crs_from_input(x) :
GDAL Error 1: PROJ: proj_create_from_database: crs not found
Edit: updated to define the target_crs as a number. Apparently, this is what was causing the error (see the answer). The solution is to use target_crs <- "ESRI:102003"
, this does not raise an error.