Big thanks to author, but an error ocurred to me when select biggest polygon , I don’t know if it is due to different version of packages.
the error is below :
error in evaluating the argument ‘x’ in selecting a method for function ‘as.lines’: Problem with mutate() column area.
area = expanse(exploded).
area must be size 0 or 1, not 759.
Caused by error in abort_glue():

But it works to me with modifying original code like this:
exploded$area = expanse(exploded)
r_plain <-exploded %>% filter(area > 50000**2) %>%
# And convert to lines
as.lines()

Big thanks again!

GitHub-flavored Markdown & a sane subset of HTML is supported.