title: Parallelize st_union from R's sf package
body: <p>I have some large shapefiles with multiple millions of polygons that I need to dissolve.  Depending upon the shapefile I need to either dissolve by group or just use <code>st_union</code> for all.  I have been using the <code>st_par</code> <a href="http://www.spatialanalytics.co.nz/post/2017/09/11/a-parallel-function-for-spatial-analysis-in-r/" rel="nofollow noreferrer">function</a> and it has been working great for most sf applications. Though when I use this function on <code>st_union</code> it returns a list and I cannot figure out how to parallize the sf dissolve function <code>st_union</code>.</p>
  
  <p>Any suggestions would be most helpful!  Here is a small code snippet to illustrate my point.</p>
  
  <pre><code>library(sf)
  library(assertthat)
  library(parallel)
  
  us_shp &lt;- "data/cb_2016_us_state_20m/cb_2016_us_state_20m.shp"
  if (!file.exists(us_shp)) {
    loc &lt;- "https://www2.census.gov/geo/tiger/GENZ2016/shp/cb_2016_us_state_20m.zip"
    dest &lt;- paste0("data/cb_2016_us_state_20m", ".zip")
    download.file(loc, dest)
    unzip(dest, exdir = "data/cb_2016_us_state_20m")
    unlink(dest)
    assert_that(file.exists(us_shp))
  }
  
  usa &lt;- st_read("data/cb_2016_us_state_20m/cb_2016_us_state_20m.shp", quiet= TRUE) %&gt;%
    filter(!(STUSPS %in% c("AK", "HI", "PR")))
  
  test &lt;- usa %&gt;%
    st_par(., st_union, n_cores = 2)
  </code></pre>