pkgdown::build_article() fails with large chunk sizes using sf and leaflet, no errors reported when setting quiet=FALSE

46 Views Asked by At
  • pkgdown::build_articles() fails with large chunk sizes
  • rmarkdown::render() works fine
  • article fails to render any code or text beyond the failed chunk
  • no errors are reported with build_article(quiet=FALSE)

enter image description here

  • reproducible example below
  • sf object and plotted with tmap fails at ~9300000 bytes
  • not package specific, reproducible with leaflet / htmlwidget objects as well as tmap

Run with:

  • pkgdown::build_article(... quiet=FALSE) - fails

  • rmarkdown::render(...) - success

    
    ---
    title: "sf multi-map"
    output: html_document
    ---
  


    ### runs fine with 1000 rows (1260632 bytes)
    
    ```{r}
    library(sf)
    library(tmap)
    
    
    nc <- st_read(system.file("shape/nc.shp", package="sf"))
    merged <- do.call(rbind, rep(list(nc), 10))
    
    object.size(merged)
    nrow(merged)
    
    tmap_mode("view") +
      tm_shape(merged) +
      tm_fill(col="NAME", lwd = 0.2) 

  
    ```

    ## no map with 7500 rows (9331032 bytes)

     ```{r, error = TRUE}

    library(sf)
    library(tmap)
    
    
    nc <- st_read(system.file("shape/nc.shp", package="sf"))
    merged <- do.call(rbind, rep(list(nc), 90))
    
    object.size(merged)
    nrow(merged)
    
    tmap_mode("view") +
       tm_shape(merged) +
       tm_fill(col="NAME", lwd = 0.2)

 
    ```


    ## no map with 7500 rows with leaflet (9331032 bytes)


    ```{r, error = TRUE}

    library(sf)
    library(tmap)

    nc <- st_read(system.file("shape/nc.shp", package="sf"))
    merged <- do.call(rbind, rep(list(nc), 90))
    
    object.size(merged)
    nrow(merged)
    
    tmp <- tmap_mode("view") +
       tm_shape(merged) +
       tm_fill(col="NAME", lwd = 0.2)
    
    tmp2 <- tmap_leaflet(tmp)
    
    object.size(tmp2)
 
    tmp2

    ```
0

There are 0 best solutions below