How can I make a reactive expression for 2 objects that relate to each other?

How can I make a reactive expression for 2 objects that relate to each other, an sf and a raster (stars).

I want that the selection of nc_01 (vector) displays in one plot and the corresponden nc_01 (raster) displays in another plot. The same for other vectors and rasters stored in the sf object and the stars object.

library(sf)
library(stars)

nc_01 = st_read(system.file("shape/nc.shp", package="sf")) |>
  mutate(map = "nc_01")
  
nc_02 = st_read(system.file("shape/nc.shp", package="sf")) |>
  mutate(map = "nc_02")
nc_severals <- bind_rows(nc_01, nc_02)
nc_01_r <- nc |> select(AREA) |> st_rasterize()
nc_02_r <- nc |> select(PERIMETER) |> st_rasterize()
nc_raster_severals <- c(nc_01_r, nc_02_r, nms = c("nc_01", "nc_02"))

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.