Skip to content

How to use st_rasterize (stars) for a categorical field like terra does?

1 message · Manuel Spínola

#
Dear list members,

When using the terra package:

f <- system.file("ex/lux.shp", package="terra")
v <- vect(f)
r <- rast(v, ncols=75, nrows=100)
z <- rasterize(v, r, "NAME_2")
plot(z)
lines(v)

How can I obtain the same result using st_rasterize from stars?

Manuel