A similar question was asked in another thread and they suggested
using st_transform if it is a data.file class but R doesn't recognise
that function. What could be the problem in this case?
There are two different, incompatible spatial data types in R with two different, packages with differently-named functions to work with them.
The older types use the
rgdal packages, and create data called things like "SpatialPolygonsDataFrames". You use
spTransform to transform those.
The newer types use the
sf package, and use functions beginning
st_ to work on them, such as
st_transform to change coordinate systems.
You have tried to use an
sp function on an
sf data object, hence the error:
unable to find an inherited method for function ‘spTransform’ for signature ‘"sf", "CRS"’
Without knowing exactly how you got an
sf object (
threeStates) or what you intend to do with it its hard to give an exact way for you to proceed here. But to convert from
sf you can so
st_as_sf(something), and to convert the other way from
sp you can do
sf package with
install.packages("sf") and then after doing
might get you past this (although we have no idea what