Skip to content

Commit

Permalink
run tests/vignette single-threadedly
Browse files Browse the repository at this point in the history
  • Loading branch information
sbfnk committed Oct 19, 2023
1 parent 503b106 commit d3d4887
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
1 change: 1 addition & 0 deletions tests/testthat.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ library(testthat)
library(socialmixr)
# nolint end

data.table::setDTthreads(1)
test_check("socialmixr")
5 changes: 0 additions & 5 deletions tests/testthat/test-plot.r
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,21 @@ suppressWarnings({
})

test_that("contact matrix can be plotted", {
skip_on_cran()
expect_no_error(matrix_plot(dta$matrix))
})

test_that("contact matrix per capita can be plotted", {
skip_on_cran()
expect_no_error(matrix_plot(dta$matrix.per.capita))
})

test_that("contact matrix can be plotted with different color palette", {
skip_on_cran()
expect_no_error(matrix_plot(dta$matrix, color.palette = rainbow))
})

test_that("contact matrix can be plotted with ad-hoc min and max values for the legend", {
skip_on_cran()
expect_no_error(matrix_plot(dta$matrix, min.legend = 4, max.legend = 40))
})

test_that("contact matrix can be plotted with (ad-hoc) min and max values for the legend", {
skip_on_cran()
expect_no_error(matrix_plot(dta$matrix, min.legend = 4, max.legend = 40))
})
3 changes: 2 additions & 1 deletion vignettes/socialmixr.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
)
data.table::setDTthreads(1)
```

[socialmixr](https://github.com/epiforecasts/socialmixr) is an `R` package to derive social mixing matrices from survey data. These are particularly useful for age-structured [infectious disease models](https://en.wikipedia.org/wiki/Mathematical_modelling_of_infectious_disease). For background on age-specific mixing matrices and what data inform them, see, for example, the paper on POLYMOD by [@mossong_social_2008].
Expand Down Expand Up @@ -489,7 +490,7 @@ ggplot(df, aes(x = age.group, y = age.group.contact, fill = contacts)) +

The contact matrices can also be plotted with the `matrix_plot()` function as a grid of colored rectangles with the numeric values in the cells. Heat colors are used by default, though this can be changed.

```{r fig.width=4, fig.height=4, eval = FALSE}
```{r fig.width=4, fig.height=4}
matrix_plot(mr)
matrix_plot(mr, color.palette = gray.colors)
```
Expand Down

0 comments on commit d3d4887

Please sign in to comment.