library(sf)
polys <- st_sf(cw = c(FALSE, TRUE),
st_as_sfc(c('POLYGON ((0 0, 1 0, 1 1, 0 0))',
'POLYGON ((1 1, 2 2, 2 1, 1 1))')))
st_force_polygon_cw(polys)
st_force_polygon_cw(st_geometry(polys))
st_force_polygon_cw(st_geometry(polys)[[1]])
Run the code above in your browser using DataLab