rekonstrukt/swedishbutterflies

Faceting variables must have at leas one value - Win 10 package development - test failing

Opened this issue · 1 comments

sebms_precip_temp_2015_plot() works fine when executed in console. However running "test-sebms-various.R" gives the following error regarding the same function:

test-sebms-various.R:10: error: figure w precip and temp 2015 works
Faceting variables must have at least one value
1: sebms_precip_temp_2015_plot() at C:\Users\Carsten Kost\Documents\swedishbutterflies_orig/tests/testthat/test-sebms-various.R:10
2: sebms_precip_temp_plot() at C:\Users\Carsten Kost\Documents\swedishbutterflies_orig/R/plot.R:140
3: map2(pplots, fn_temp, save_pplot) at C:\Users\Carsten Kost\Documents\swedishbutterflies_orig/R/plot.R:178
4: .f(.x[[i]], .y[[i]], ...)
5: ggsave(filename = fn, plot = g, device = "png", width = w,
height = h) at C:\Users\Carsten Kost\Documents\swedishbutterflies_orig/R/plot.R:165
6: grid.draw(plot)
7: grid.draw.ggplot(plot)
8: print(x)
9: print.ggplot(x)
10: ggplot_build(x)
11: ggplot_build.ggplot(x)
12: layout$setup(layer_data, plot$data, plot$plot_env)
13: f(..., self = self)
14: self$facet$compute_layout(data, self$facet_params)
15: f(...)
16: plyr::unrowname(combine_vars(data, params$plot_env, vars,
drop = params$drop))
17: combine_vars(data, params$plot_env, vars, drop = params$drop)
18: stop("Faceting variables must have at least one value", call. = FALSE)


sessionInfo()
R version 3.5.1 (2018-07-02)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

locale:
[1] LC_COLLATE=English_Sweden.1252 LC_CTYPE=English_Sweden.1252 LC_MONETARY=English_Sweden.1252 LC_NUMERIC=C
[5] LC_TIME=English_Sweden.1252

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] sp_1.3-1 leaflet_2.0.1 DT_0.4 tibble_1.4.2 bindrcpp_0.2.2
[6] knitr_1.20 dplyr_0.7.6 purrr_0.2.5 swedishbutterflies_0.1.3 magick_1.9

loaded via a namespace (and not attached):
[1] Rcpp_0.12.18 lubridate_1.7.4 lattice_0.20-35 tidyr_0.8.1 png_0.1-7 zoo_1.8-3
[7] assertthat_0.2.0 digest_0.6.15 mime_0.5 R6_2.2.2 plyr_1.8.4 ggplot2_3.0.0
[13] highr_0.7 pillar_1.3.0 rlang_0.2.1 curl_3.2 lazyeval_0.2.1 rstudioapi_0.7
[19] raster_2.6-7 hexbin_1.27.2 blob_1.1.1 RPostgres_1.1.1 config_0.3 labeling_0.3
[25] rgdal_1.3-4 stringr_1.3.1 htmlwidgets_1.2 bit_1.1-14 munsell_0.5.0 shiny_1.1.0
[31] compiler_3.5.1 httpuv_1.4.5 base64enc_0.1-3 pkgconfig_2.0.1 htmltools_0.3.6 tidyselect_0.2.4
[37] viridisLite_0.3.0 crayon_1.3.4 dbplyr_1.2.2 later_0.7.3 rappdirs_0.3.1 grid_3.5.1
[43] jsonlite_1.5 xtable_1.8-2 gtable_0.2.0 DBI_1.0.0 magrittr_1.5 scales_0.5.0
[49] stringi_1.1.7 promises_1.0.1 ggthemes_4.0.0 latticeExtra_0.6-28 cowplot_0.9.3 RColorBrewer_1.1-2
[55] tools_3.5.1 bit64_0.9-7 glue_1.3.0 hms_0.4.2 crosstalk_1.0.0 parallel_3.5.1
[61] yaml_2.2.0 colorspace_1.3-2 rasterVis_0.45 pool_0.1.4.1 bindr_0.1.1

In addition this works when opening "test-sebms-various.R", and handing the code from the testscript to the console through ctrl+Enter or copying it into the console and executing it. Yet it fails when pressing ctrl+shift+T. Could this be a problem with how RStudio handles pathing when testing under windows (10)?