diff options
author | Ken Kellner <ken@kenkellner.com> | 2023-06-23 15:58:45 -0400 |
---|---|---|
committer | Ken Kellner <ken@kenkellner.com> | 2023-06-23 15:58:45 -0400 |
commit | 658696333513e66c2cee101c5ec54b4879fff88e (patch) | |
tree | 01871c98a772e14389416098d2171584f106d78a | |
parent | c82e63947d7df7dfc896066e51dbf63bda3babf4 (diff) |
Add drop argument to posteriorSamples [ method
-rw-r--r-- | DESCRIPTION | 4 | ||||
-rw-r--r-- | R/posteriorSamples.R | 4 | ||||
-rw-r--r-- | tests/testthat/test_ranef_predict.R | 2 |
3 files changed, 5 insertions, 5 deletions
diff --git a/DESCRIPTION b/DESCRIPTION index e51f0d7..894773a 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: unmarked -Version: 1.2.5.9014 -Date: 2023-04-27 +Version: 1.2.5.9015 +Date: 2023-06-23 Type: Package Title: Models for Data from Unmarked Animals Authors@R: c( diff --git a/R/posteriorSamples.R b/R/posteriorSamples.R index 3b84ef0..9389e14 100644 --- a/R/posteriorSamples.R +++ b/R/posteriorSamples.R @@ -57,7 +57,7 @@ print.unmarkedPostSamples <- function(x, ...){ } setMethod("[", c("unmarkedPostSamples","ANY","ANY","ANY"), - function(x, i, j, k) + function(x, i, j, k, drop = FALSE) { - x@samples[i,j,k] + x@samples[i,j,k, drop = drop] }) diff --git a/tests/testthat/test_ranef_predict.R b/tests/testthat/test_ranef_predict.R index 251ed29..7da3f54 100644 --- a/tests/testthat/test_ranef_predict.R +++ b/tests/testthat/test_ranef_predict.R @@ -29,7 +29,7 @@ test_that("ranef predict method works",{ expect_equivalent(dim(ps@samples), c(9,1,10)) # Brackets - expect_equal(ps[1,1,1], ps@samples[1,1,1]) + expect_equal(ps[1,1,1], ps@samples[1,1,1,drop=FALSE]) # Method for unmarkedFit objects set.seed(123) |