as.im() was in maptools, which was retired last year. If you need to recreate
old work, install maptools from source from the CRAN package archive
https://cran.r-project.org/src/contrib/Archive/maptools/.
For non-archival work, update the workflow. See also
r.grid.world.SGDF.F[[1]] is a numerical vector, not even a matrix, so
clearly as.im.default doesn't know what it should do with it.
Maybe there was once a method as.im for r.grid.world.SGDF.F, which is of
class SpatialGridDataFrame, but no longer - software evolves.
A way you could approach