Skip to content

Commit

Permalink
Solving conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
gvegayon committed Jun 11, 2024
2 parents 9607b1e + b4eb34d commit 7f18e9c
Show file tree
Hide file tree
Showing 12 changed files with 61 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configure.ac text eol=lf

inst/include/epiworld/** linguist-vendored
39 changes: 39 additions & 0 deletions .github/workflows/coverage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]

name: Coverage

jobs:
coverage:
runs-on: ubuntu-latest
name: Coverage

steps:
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r@v2.9.0

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::covr
needs: check

- name: Running coverage
run: |
# Files to exclude
files <- list.files("inst/", full.names = TRUE, recursive = TRUE)
# Run coverage
covr::codecov(
line_exclusions = as.list(files),
token = Sys.getenv("CODECOV_TOKEN")
)
shell: Rscript {0}
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

1 change: 1 addition & 0 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ knitr::opts_chunk$set(
[![R-CMD-check](https://github.com/UofUEpiBio/epiworldR/actions/workflows/r.yml/badge.svg)](https://github.com/UofUEpiBio/epiworldR/actions/workflows/r.yml)
[![CRANlogs downloads](https://cranlogs.r-pkg.org/badges/grand-total/epiworldR)](https://cran.r-project.org/package=epiworldR)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/UofUEpiBio/epiworldR/blob/master/LICENSE.md)
[![codecov](https://codecov.io/gh/UofUEpiBio/epiworldR/graph/badge.svg?token=ZB8FVLI7GN)](https://codecov.io/gh/UofUEpiBio/epiworldR)
<!-- badges: end -->

This R package is a wrapper of the C++ library [epiworld](https://github.com/UofUEpiBio/epiworld){target="_blank"}. It provides a general framework for modeling disease transmission using [agent-based models](https://en.wikipedia.org/w/index.php?title=Agent-based_model&oldid=1153634802){target="_blank"}. Some of the main features include:
Expand Down
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ status](https://www.r-pkg.org/badges/version/epiworldR)](https://CRAN.R-project.
downloads](https://cranlogs.r-pkg.org/badges/grand-total/epiworldR)](https://cran.r-project.org/package=epiworldR)
[![License:
MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/UofUEpiBio/epiworldR/blob/master/LICENSE.md)
[![codecov](https://codecov.io/gh/UofUEpiBio/epiworldR/graph/badge.svg?token=ZB8FVLI7GN)](https://codecov.io/gh/UofUEpiBio/epiworldR)
<!-- badges: end -->

This R package is a wrapper of the C++ library
Expand Down Expand Up @@ -140,8 +141,8 @@ summary(sir)
#> Number of entities : 0
#> Days (duration) : 50 (of 50)
#> Number of viruses : 1
#> Last run elapsed t : 163.00ms
#> Last run speed : 30.49 million agents x day / second
#> Last run elapsed t : 165.00ms
#> Last run speed : 30.23 million agents x day / second
#> Rewiring : off
#>
#> Global events:
Expand Down Expand Up @@ -228,8 +229,8 @@ summary(model_seirconn)
#> Number of entities : 0
#> Days (duration) : 100 (of 100)
#> Number of viruses : 2
#> Last run elapsed t : 36.00ms
#> Last run speed : 27.62 million agents x day / second
#> Last run elapsed t : 39.00ms
#> Last run speed : 25.12 million agents x day / second
#> Rewiring : off
#>
#> Global events:
Expand Down
2 changes: 1 addition & 1 deletion inst/tinytest/test-get.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ set.seed(1231)
# to check that.
expect_equal(nrow(get_hist_tool(model)), 0L)
expect_equal(nrow(get_hist_total(model)), 0L)
expect_equal(nrow(get_hist_variant(model)), 0L)
expect_equal(nrow(get_hist_virus(model)), 0L)
expect_equal(nrow(get_reproductive_number(model)), 0L)
expect_equal(dim(get_transition_probability(model)), c(3, 3))
expect_equal(nrow(get_hist_transition_matrix(model)), 0L)
Expand Down
23 changes: 13 additions & 10 deletions inst/tinytest/test-sir.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@ agents_smallworld(

# Initializing
queuing_off(sir_0)
init(sir_0, days = 50, seed = 1912)

# Running and printing
run(sir_0)
run(sir_0, ndays = 50, seed = 1912)

tmat_0 <- get_transition_probability(sir_0)

Expand All @@ -40,19 +39,23 @@ agents_smallworld(
p = .01
)

# Initializing
init(sir_1, days = 50, seed = 1912)

# Running and printing
run(sir_1)
run(sir_1, ndays = 50, seed = 1912)

tmat_1 <- get_transition_probability(sir_1)

# Expected
tmat_expected <- structure(c(0.90395575761795, 0, 0, 0.0959785506129265, 0.707067608833313,
0, 6.55534968245775e-05, 0.292932420969009, 1), dim = c(3L, 3L
), dimnames = list(c("Susceptible", "Infected", "Recovered"),
c("Susceptible", "Infected", "Recovered")))
tmat_expected <- structure(
c(
0.963432729244232, 0, 0, 0.0365671403706074, 0.702733814716339,
0, 0, 0.297266155481339, 1
),
dim = c(3L, 3L),
dimnames = list(
c("Susceptible", "Infected", "Recovered"),
c("Susceptible", "Infected", "Recovered")
)
)

expect_equivalent(tmat_0, tmat_1)
expect_equivalent(tmat_0, tmat_expected)
Expand Down
Binary file added man/figures/README-unnamed-chunk-4-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added man/figures/README-unnamed-chunk-4-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added man/figures/README-unnamed-chunk-4-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added man/figures/README-unnamed-chunk-4-4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added man/figures/README-unnamed-chunk-6-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 1 addition & 4 deletions playground/epiworld_presentation.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,8 @@ agents_smallworld(
p = .01
)
# Initializing
init(seir, days = 100, seed = 1912)
# Running and printing
run(seir)
run(seir, ndays = 100, seed = 1912)
seir
```
Expand Down

0 comments on commit 7f18e9c

Please sign in to comment.