Running ‘testthat.R’ [21s/22s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
  > library(testthat)
  > library(ggspatial)
  Loading required package: ggplot2
  > 
  > test_check("ggspatial")
  ── 1. Error: north arrow drawing works (@test-annotation-north-arrow.R#6)  ─────
  VECTOR_ELT() can only be applied to a 'list', not a 'double'
  1: print(ggplot() + geom_point(aes(x, y), data = data.frame(x = 0:4, y = -(0:4))) + 
         annotation_north_arrow() + labs(caption = "default behaviour of north arrow in cartesian coordinates")) at testthat/test-annotation-north-arrow.R:6
  2: print.ggplot(ggplot() + geom_point(aes(x, y), data = data.frame(x = 0:4, y = -(0:4))) + 
         annotation_north_arrow() + labs(caption = "default behaviour of north arrow in cartesian coordinates"))
  3: grid.draw(gtable)
  4: grid.draw.gTree(gtable)
  5: recordGraphics(drawGTree(x), list(x = x), getNamespace("grid"))
  6: drawGTree(x)
  7: preDraw(x)
  8: preDraw.gTree(x)
  9: pushvpgp(x)
  10: pushgrobvp(x$vp)
  11: pushgrobvp.viewport(x$vp)
  12: pushViewport(vp, recording = FALSE)
  13: lapply(vps, push.vp, recording)
  14: FUN(X[[i]], ...)
  15: push.vp.viewport(X[[i]], ...)
  16: grid.Call.graphics(C_setviewport, vp, TRUE)
  
  ── 2. Error: true north arrow points in the right direction (@test-annotation-no
  VECTOR_ELT() can only be applied to a 'list', not a 'double'
  1: print(ggplot() + geom_sf(data = longlake_waterdf) + annotation_north_arrow(location = "tl", 
         which_north = "grid") + annotation_north_arrow(location = "tr", which_north = "grid") + 
         annotation_north_arrow(location = "bl", which_north = "grid") + annotation_north_arrow(location = "br", 
         which_north = "grid") + coord_sf(crs = 26922) + labs(caption = "North arrow pointing to 'grid' north")) at testthat/test-annotation-north-arrow.R:54
  2: print.ggplot(ggplot() + geom_sf(data = longlake_waterdf) + annotation_north_arrow(location = "tl", 
         which_north = "grid") + annotation_north_arrow(location = "tr", which_north = "grid") + 
         annotation_north_arrow(location = "bl", which_north = "grid") + annotation_north_arrow(location = "br", 
         which_north = "grid") + coord_sf(crs = 26922) + labs(caption = "North arrow pointing to 'grid' north"))
  3: grid.draw(gtable)
  4: grid.draw.gTree(gtable)
  5: recordGraphics(drawGTree(x), list(x = x), getNamespace("grid"))
  6: drawGTree(x)
  7: preDraw(x)
  8: preDraw.gTree(x)
  9: pushvpgp(x)
  10: pushgrobvp(x$vp)
  11: pushgrobvp.viewport(x$vp)
  12: pushViewport(vp, recording = FALSE)
  13: lapply(vps, push.vp, recording)
  14: FUN(X[[i]], ...)
  15: push.vp.viewport(X[[i]], ...)
  16: grid.Call.graphics(C_setviewport, vp, TRUE)
  
  ── 3. Error: all built-in styles of north arrow rotate properly (@test-annotatio
  VECTOR_ELT() can only be applied to a 'list', not a 'double'
  1: print(p + annotation_north_arrow(location = "tl", which_north = "true", style = north_arrow_orienteering) + 
         annotation_north_arrow(location = "tr", which_north = "true", style = north_arrow_fancy_orienteering) + 
         annotation_north_arrow(location = "bl", which_north = "true", style = north_arrow_minimal) + 
         annotation_north_arrow(location = "br", which_north = "true", style = north_arrow_nautical) + 
         labs(caption = "All four arrows should point to the north pole and have different styles")) at testthat/test-annotation-north-arrow.R:104
  2: print.ggplot(p + annotation_north_arrow(location = "tl", which_north = "true", style = north_arrow_orienteering) + 
         annotation_north_arrow(location = "tr", which_north = "true", style = north_arrow_fancy_orienteering) + 
         annotation_north_arrow(location = "bl", which_north = "true", style = north_arrow_minimal) + 
         annotation_north_arrow(location = "br", which_north = "true", style = north_arrow_nautical) + 
         labs(caption = "All four arrows should point to the north pole and have different styles"))
  3: grid.draw(gtable)
  4: grid.draw.gTree(gtable)
  5: recordGraphics(drawGTree(x), list(x = x), getNamespace("grid"))
  6: drawGTree(x)
  7: preDraw(x)
  8: preDraw.gTree(x)
  9: pushvpgp(x)
  10: pushgrobvp(x$vp)
  11: pushgrobvp.viewport(x$vp)
  12: pushViewport(vp, recording = FALSE)
  13: lapply(vps, push.vp, recording)
  14: FUN(X[[i]], ...)
  15: push.vp.viewport(X[[i]], ...)
  16: grid.Call.graphics(C_setviewport, vp, TRUE)
  
  ── 4. Error: certain parameters can be passed as aesthetics to show up on differ
  VECTOR_ELT() can only be applied to a 'list', not a 'double'
  1: print(ggplot() + layer_spatial(longlake_waterdf) + annotation_north_arrow(aes(which_north = which_north, 
         location = location), data = arrow_params) + facet_wrap(~label) + labs(caption = "two north arrows in different panels with different parameters")) at testthat/test-annotation-north-arrow.R:144
  2: print.ggplot(ggplot() + layer_spatial(longlake_waterdf) + annotation_north_arrow(aes(which_north = which_north, 
         location = location), data = arrow_params) + facet_wrap(~label) + labs(caption = "two north arrows in different panels with different parameters"))
  3: ggplot_gtable(data)
  4: ggplot_gtable.ggplot_built(data)
  5: layout$render(geom_grobs, data, theme, plot$labels)
  6: f(..., self = self)
  7: self$facet$draw_panels(panels, self$layout, self$panel_scales_x, self$panel_scales_y, 
         self$panel_params, self$coord, data, theme, self$facet_params)
  8: f(...)
  9: render_strips(structure(labels_df, type = "rows"), structure(labels_df, type = "cols"), 
         params$labeller, theme)
  10: build_strip(x, labeller, theme, TRUE)
  11: ggstrip(grobs, theme, element, gp, horizontal, clip = "on")
  12: Summary.unit(structure(c(4.4, 4.4), unit = 8L, class = c("margin", "unit")), na.rm = FALSE)
  
  ── 5. Error: annotation scale works as intended (@test-annotation-scale.R#48)  ─
  VECTOR_ELT() can only be applied to a 'list', not a 'double'
  1: print(ggplot() + geom_sf(data = nc) + annotation_scale() + labs(caption = "defaults for annotation_scale() with coord_sf()")) at testthat/test-annotation-scale.R:48
  2: print.ggplot(ggplot() + geom_sf(data = nc) + annotation_scale() + labs(caption = "defaults for annotation_scale() with coord_sf()"))
  3: grid.draw(gtable)
  4: grid.draw.gTree(gtable)
  5: recordGraphics(drawGTree(x), list(x = x), getNamespace("grid"))
  6: drawGTree(x)
  7: preDraw(x)
  8: preDraw.gTree(x)
  9: pushvpgp(x)
  10: pushgrobvp(x$vp)
  11: pushgrobvp.viewport(x$vp)
  12: pushViewport(vp, recording = FALSE)
  13: lapply(vps, push.vp, recording)
  14: FUN(X[[i]], ...)
  15: push.vp.viewport(X[[i]], ...)
  16: grid.Call.graphics(C_setviewport, vp, TRUE)
  
  ── 6. Error: font items are passed on to annotation_scale() (@test-annotation-sc
  VECTOR_ELT() can only be applied to a 'list', not a 'double'
  1: print(ggplot() + geom_point(aes(x, y), data = data.frame(x = 0:4, y = -(0:4))) + 
         annotation_scale(plot_unit = "m", text_face = "bold") + annotation_scale(plot_unit = "m", 
         pad_y = unit(1, "cm")) + annotation_scale(plot_unit = "m", pad_y = unit(2, "cm"), 
         text_family = "serif") + labs(caption = "serif label, default label, bold label") + 
         coord_fixed()) at testthat/test-annotation-scale.R:132
  2: print.ggplot(ggplot() + geom_point(aes(x, y), data = data.frame(x = 0:4, y = -(0:4))) + 
         annotation_scale(plot_unit = "m", text_face = "bold") + annotation_scale(plot_unit = "m", 
         pad_y = unit(1, "cm")) + annotation_scale(plot_unit = "m", pad_y = unit(2, "cm"), 
         text_family = "serif") + labs(caption = "serif label, default label, bold label") + 
         coord_fixed())
  3: grid.draw(gtable)
  4: grid.draw.gTree(gtable)
  5: recordGraphics(drawGTree(x), list(x = x), getNamespace("grid"))
  6: drawGTree(x)
  7: preDraw(x)
  8: preDraw.gTree(x)
  9: pushvpgp(x)
  10: pushgrobvp(x$vp)
  11: pushgrobvp.viewport(x$vp)
  12: pushViewport(vp, recording = FALSE)
  13: lapply(vps, push.vp, recording)
  14: FUN(X[[i]], ...)
  15: push.vp.viewport(X[[i]], ...)
  16: grid.Call.graphics(C_setviewport, vp, TRUE)
  
  ── 7. Error: certain parameters can be passed as aesthetics to show up on differ
  VECTOR_ELT() can only be applied to a 'list', not a 'double'
  1: print(ggplot(df) + geom_point(aes(x, y)) + annotation_scale(aes(width_hint = width_hint, 
         style = style, location = location, unit_category = unit_category, text_col = text_col, 
         line_col = line_col), data = scale_params, plot_unit = "m") + facet_wrap(~facet_var) + 
         coord_fixed() + labs(caption = "three scale bars in different panels with different parameters")) at testthat/test-annotation-scale.R:164
  2: print.ggplot(ggplot(df) + geom_point(aes(x, y)) + annotation_scale(aes(width_hint = width_hint, 
         style = style, location = location, unit_category = unit_category, text_col = text_col, 
         line_col = line_col), data = scale_params, plot_unit = "m") + facet_wrap(~facet_var) + 
         coord_fixed() + labs(caption = "three scale bars in different panels with different parameters"))
  3: ggplot_gtable(data)
  4: ggplot_gtable.ggplot_built(data)
  5: layout$render(geom_grobs, data, theme, plot$labels)
  6: f(..., self = self)
  7: self$facet$draw_panels(panels, self$layout, self$panel_scales_x, self$panel_scales_y, 
         self$panel_params, self$coord, data, theme, self$facet_params)
  8: f(...)
  9: render_strips(structure(labels_df, type = "rows"), structure(labels_df, type = "cols"), 
         params$labeller, theme)
  10: build_strip(x, labeller, theme, TRUE)
  11: ggstrip(grobs, theme, element, gp, horizontal, clip = "on")
  12: Summary.unit(structure(c(4.4, 4.4), unit = 8L, class = c("margin", "unit")), na.rm = FALSE)
  
  ── 8. Error: polypath works as intended (@test-geom-polypath.R#6)  ─────────────
  VECTOR_ELT() can only be applied to a 'list', not a 'double'
  1: print(ggplot() + geom_polygon(aes(x, y, group = piece_id), data = df) + labs(caption = "this polygon doesn't have the holes right!")) at testthat/test-geom-polypath.R:6
  2: print.ggplot(ggplot() + geom_polygon(aes(x, y, group = piece_id), data = df) + labs(caption = "this polygon doesn't have the holes right!"))
  3: grid.draw(gtable)
  4: grid.draw.gTree(gtable)
  5: recordGraphics(drawGTree(x), list(x = x), getNamespace("grid"))
  6: drawGTree(x)
  7: preDraw(x)
  8: preDraw.gTree(x)
  9: pushvpgp(x)
  10: pushgrobvp(x$vp)
  11: pushgrobvp.viewport(x$vp)
  12: pushViewport(vp, recording = FALSE)
  13: lapply(vps, push.vp, recording)
  14: FUN(X[[i]], ...)
  15: push.vp.viewport(X[[i]], ...)
  16: grid.Call.graphics(C_setviewport, vp, TRUE)
  
  ── 9. Error: geom_spatial_* geoms work properly (@test-geom_spatial.R#33)  ─────
  VECTOR_ELT() can only be applied to a 'list', not a 'double'
  1: expect_silent(print(point)) at testthat/test-geom_spatial.R:33
  2: quasi_capture(enquo(object), evaluate_promise)
  3: capture(act$val <- eval_bare(get_expr(quo), get_env(quo)))
  4: withr::with_output_sink(temp, withCallingHandlers(withVisible(code), warning = handle_warning, 
         message = handle_message))
  5: force(code)
  6: withCallingHandlers(withVisible(code), warning = handle_warning, message = handle_message)
  7: withVisible(code)
  8: eval_bare(get_expr(quo), get_env(quo))
  9: print(point)
  10: print.ggplot(point)
  ...
  24: pushvpgp(x)
  25: pushgrobvp(x$vp)
  26: pushgrobvp.viewport(x$vp)
  27: pushViewport(vp, recording = FALSE)
  28: lapply(vps, push.vp, recording)
  29: FUN(X[[i]], ...)
  30: push.vp.vpTree(X[[i]], ...)
  31: push.vp(vp$parent, recording)
  32: push.vp.viewport(vp$parent, recording)
  33: grid.Call.graphics(C_setviewport, vp, TRUE)
  
  ── 10. Error: spatial labellers work properly (@test-geom_spatial.R#63)  ───────
  VECTOR_ELT() can only be applied to a 'list', not a 'double'
  1: print(p + geom_spatial_text(crs = 4326) + labs(caption = "geom_spatial_text()")) at testthat/test-geom_spatial.R:63
  2: print.ggplot(p + geom_spatial_text(crs = 4326) + labs(caption = "geom_spatial_text()"))
  3: grid.draw(gtable)
  4: grid.draw.gTree(gtable)
  5: recordGraphics(drawGTree(x), list(x = x), getNamespace("grid"))
  6: drawGTree(x)
  7: preDraw(x)
  8: preDraw.gTree(x)
  9: pushvpgp(x)
  10: pushgrobvp(x$vp)
  11: pushgrobvp.viewport(x$vp)
  12: pushViewport(vp, recording = FALSE)
  13: lapply(vps, push.vp, recording)
  14: FUN(X[[i]], ...)
  15: push.vp.viewport(X[[i]], ...)
  16: grid.Call.graphics(C_setviewport, vp, TRUE)
  
  ── 11. Error: stat_spatial_identity function (@test-geom_spatial.R#95)  ────────
  VECTOR_ELT() can only be applied to a 'list', not a 'double'
  1: expect_message(print(ggplot() + annotation_spatial(longlake_waterdf, fill = "lightblue") + 
         stat_spatial_identity(aes(LON, LAT, col = DEPTH_M), data = df) + labs(caption = "all the points should be in the lake!")), 
         "Assuming crs") at testthat/test-geom_spatial.R:95
  2: quasi_capture(enquo(object), capture_messages, label = label)
  3: capture(act$val <- eval_bare(get_expr(quo), get_env(quo)))
  4: withCallingHandlers(code, message = function(condition) {
         out$push(condition)
         invokeRestart("muffleMessage")
     })
  5: eval_bare(get_expr(quo), get_env(quo))
  6: print(ggplot() + annotation_spatial(longlake_waterdf, fill = "lightblue") + stat_spatial_identity(aes(LON, 
         LAT, col = DEPTH_M), data = df) + labs(caption = "all the points should be in the lake!"))
  7: print.ggplot(ggplot() + annotation_spatial(longlake_waterdf, fill = "lightblue") + 
         stat_spatial_identity(aes(LON, LAT, col = DEPTH_M), data = df) + labs(caption = "all the points should be in the lake!"))
  8: ggplot_gtable(data)
  9: ggplot_gtable.ggplot_built(data)
  10: build_guides(plot$scales, plot$layers, plot$mapping, position, theme, plot$guides, 
         plot$labels)
  ...
  21: pushvpgp(x)
  22: pushgrobvp(x$vp)
  23: pushgrobvp.viewport(x$vp)
  24: pushViewport(vp, recording = FALSE)
  25: lapply(vps, push.vp, recording)
  26: FUN(X[[i]], ...)
  27: push.vp.vpTree(X[[i]], ...)
  28: push.vp(vp$parent, recording)
  29: push.vp.viewport(vp$parent, recording)
  30: grid.Call.graphics(C_setviewport, vp, TRUE)
  
  ── 12. Error: layer_spatial() works as intended (@test-layer-spatial.R#6)  ─────
  VECTOR_ELT() can only be applied to a 'list', not a 'double'
  1: print(ggplot() + layer_spatial(longlake_roadsdf, size = 1, col = "black") + layer_spatial(longlake_roadsdf, 
         size = 0.8, col = "white") + layer_spatial(longlake_waterdf, fill = "lightblue", 
         col = NA) + layer_spatial(longlake_depthdf, aes(col = DEPTH_M)) + labs(caption = "Should show long lake, round lake, etc.")) at testthat/test-layer-spatial.R:6
  2: print.ggplot(ggplot() + layer_spatial(longlake_roadsdf, size = 1, col = "black") + 
         layer_spatial(longlake_roadsdf, size = 0.8, col = "white") + layer_spatial(longlake_waterdf, 
         fill = "lightblue", col = NA) + layer_spatial(longlake_depthdf, aes(col = DEPTH_M)) + 
         labs(caption = "Should show long lake, round lake, etc."))
  3: ggplot_gtable(data)
  4: ggplot_gtable.ggplot_built(data)
  5: build_guides(plot$scales, plot$layers, plot$mapping, position, theme, plot$guides, 
         plot$labels)
  6: guides_gengrob(gdefs, theme)
  7: lapply(gdefs, guide_gengrob, theme)
  8: FUN(X[[i]], ...)
  9: guide_gengrob.colorbar(X[[i]], ...)
  10: width_cm(grob.title)
  ...
  16: pushvpgp(x)
  17: pushgrobvp(x$vp)
  18: pushgrobvp.viewport(x$vp)
  19: pushViewport(vp, recording = FALSE)
  20: lapply(vps, push.vp, recording)
  21: FUN(X[[i]], ...)
  22: push.vp.vpTree(X[[i]], ...)
  23: push.vp(vp$parent, recording)
  24: push.vp.viewport(vp$parent, recording)
  25: grid.Call.graphics(C_setviewport, vp, TRUE)
  
  ══ testthat results  ═══════════════════════════════════════════════════════════
  OK: 105 SKIPPED: 0 FAILED: 12
  1. Error: north arrow drawing works (@test-annotation-north-arrow.R#6) 
  2. Error: true north arrow points in the right direction (@test-annotation-north-arrow.R#54) 
  3. Error: all built-in styles of north arrow rotate properly (@test-annotation-north-arrow.R#104) 
  4. Error: certain parameters can be passed as aesthetics to show up on different panels (@test-annotation-north-arrow.R#144) 
  5. Error: annotation scale works as intended (@test-annotation-scale.R#48) 
  6. Error: font items are passed on to annotation_scale() (@test-annotation-scale.R#132) 
  7. Error: certain parameters can be passed as aesthetics to show up on different panels (@test-annotation-scale.R#164) 
  8. Error: polypath works as intended (@test-geom-polypath.R#6) 
  9. Error: geom_spatial_* geoms work properly (@test-geom_spatial.R#33) 
  1. ...
  
  Error: testthat unit tests failed
  Execution halted