From 9b5a9ef182a5f6bfc09b17dc89ad33d3def4ce97 Mon Sep 17 00:00:00 2001 From: Ethan Plunkett Date: Tue, 14 May 2024 15:04:51 -0400 Subject: [PATCH 1/2] fix bug in example data for rmarkdwon collection index --- DESCRIPTION | 6 ++++-- NEWS.md | 5 +++++ R/animate_distr.R | 6 +++--- inst/markdown_templates/index_example.Rds | Bin 367 -> 383 bytes man/animate_distr.Rd | 6 +++--- 5 files changed, 15 insertions(+), 8 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 774b6d59..6ae48230 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -3,12 +3,14 @@ Title: Predict and Visualize Bird Movement Version: 0.1.0.9056 Authors@R: c(person("Ethan", "Plunkett", email = "plunkett@umass.edu", role = c("aut", "cre"), - comment = c(ORCID = "0000-0003-4405-2251"))) + comment = c(ORCID = "0000-0003-4405-2251")), + person("BirdFlow-Science", role = "cph"), + person("National Science Foundation", role = "fnd")) Description: BirdFlowR predicts bird movement and distribution from previously fitted models. License: MIT + file LICENSE Encoding: UTF-8 Roxygen: list(markdown = TRUE) -RoxygenNote: 7.2.3 +RoxygenNote: 7.3.1 Suggests: BirdFlowModels (>= 0.0.2.9002), covr, diff --git a/NEWS.md b/NEWS.md index 6c5d1b45..ca4fceaa 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,8 @@ +# Birdflow 0.1.0.9058 +2024-05-07 + +* Fixed bug that prevented knitting example collection index without passed +parameters. # Birdflow 0.1.0.9057 2024-04-17 diff --git a/R/animate_distr.R b/R/animate_distr.R index f1e896de..b0163168 100644 --- a/R/animate_distr.R +++ b/R/animate_distr.R @@ -28,8 +28,8 @@ #' anim <- animate_distr(distr, bf, show_dynamic_mask = TRUE) #' #' \dontrun{ -#' # Display it -#' anim +#' # Display it +#' anim #' } #' ### Project a distribution #' @@ -65,7 +65,7 @@ #' gif_file <- tempfile("animation", fileext = ".gif") #' gganimate::save_animation(gif, gif_file) #' file.remove(gif_file) # cleanup -#' } +#' } animate_distr <- function(distr, bf, title = species(bf), ...) { p <- plot_distr(distr, bf, ...) diff --git a/inst/markdown_templates/index_example.Rds b/inst/markdown_templates/index_example.Rds index 5a1c1ebf62c92f8a8c0b4264d7f825f95fb02f3e..36342d9b2cdb7a66cb13c8c89a05bbc863626724 100644 GIT binary patch literal 383 zcmV-_0f7D=iwFP!0000025nHwPQx$|G^7Q!lt)40oF8Zvr=(3!2o8ud55cY4*c-5# z#F3p6;H&upgqy~Qq*$`OJF~Oi@pGRL;*gHx5T|QG(tUim8HENrGfB_v6SH?or;1M@ z#Zt;et}s%FTx2hniB$OtWrJyI_cmIaZR%S!NB2x7GKY6J6`52uI=o&LDBV1P;v+9m zt#nH^yh>3C2ATULC1;W?f0arCAC+brykvAJr z`VZ2qbti%6Q{YHh0CX0{5d)lrJ^)N;L_@H3(KHG%rt|_in|gqN!E8R`LFDtfhyJwH zw-aFjjo5tVn!o%a)v~vtcg?X=*LE}W0oG8@f~n+~)X6~S$OP&IGhmG!YlCEkhy`1$ z8`SUtlW8imzfdO@iH!#e69kP54u!>>lm~UV|AtBnnOUV4pV*qVr(`*{6CYOg*JO1! dZLtKjwPnG+c^Ag9T2DvF_YWxOI%fI;002wJvAzHR literal 367 zcmV-#0g(P5iwFP!0000018t8@PlG@ZhPQ=kTkA(P@ys8fVL=K#>cM#SBYGpl?x3W= zl7))?dE>Taji86k%seyi?7S~iLWn_3V?d0NO3CQy@zxF%yHLegy)*TO#3U0H&mqS~ zh^UkpOGKU)ueuY<<_(%or>i~KYjw4s@6DV%Fp-H8KCC<~gly^jW>cfE$_(nyvPQY7 zdb0U-jxuFXSkFRmCfNE%DFtx5QP&{1?x0!sl$U=EE$(@xyMImXy4@X9*Ks}D32aLL zA>CQa^BtE0N6LJlL72o0&{fLjm#v? zbUu@qAygP~s5LWk?zidTJIX2*Meo9i6wN|kdAzf>ZSG>%3d^9 Date: Tue, 14 May 2024 20:48:41 -0400 Subject: [PATCH 2/2] Fix failed test It fails only on Mac OS despite previously passing. Update to add a tolerance to equality check. --- tests/testthat/test-as_distr.R | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/testthat/test-as_distr.R b/tests/testthat/test-as_distr.R index 3eb0c354..ba311088 100644 --- a/tests/testthat/test-as_distr.R +++ b/tests/testthat/test-as_distr.R @@ -55,10 +55,14 @@ test_that("as_distr works with raster objects", { expect_warning(d <- as_distr(r, bf)) # value lost both to cropping and masking expect_equal(sum(d), 1) - # Multiple layers + # Multiple layers in raster r2 <- c(r, r, r) expect_warning(d2 <- as_distr(r2, bf)) # value lost to cropping and masking - expect_true(all(apply(d2, 2, sum) == 1)) + sums <- apply(d2, 2, sum) + for(i in seq_along(sums)) { + expect_equal(sums[i], 1) + } + expect_equal(nrow(d2), n_active(bf)) expect_equal(ncol(d2), 3) expect_equal(d2[, 1], d, ignore_attr = TRUE)