See the FAQ: How to do a minimal reproducible example reprex
for beginners. Code examples should permit reproducing the issue by simply cutting and pasting. The nzmap
in the code provided produces the error
> nzmap
Error in `get_poly_lengths()`:
! There is a MULTIPOLYGON with length greater than 1