Skip to content

Commit

Permalink
Merge pull request #1 from SABS-R3-Epidemiology/r_replication
Browse files Browse the repository at this point in the history
Passes all tests. We now need to turn the R code into functions.
  • Loading branch information
Kemuk authored Jan 14, 2025
2 parents 31e7a2f + 99abd1d commit dc7935e
Show file tree
Hide file tree
Showing 28 changed files with 1,235 additions and 34 deletions.
Binary file added .DS_Store
Binary file not shown.
12 changes: 12 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
^.*\.Rproj$
^\.Rproj\.user$
^\.travis\.yml$
^codecov\.yml$
^CRAN-RELEASE$
^cran-comments\.md$
^\.github$
^doc$
^Meta$
^windows\\i386\*
^i386\.*$
.lintr
3 changes: 0 additions & 3 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ jobs:
remotes::install_cran("lintr")
shell: Rscript {0}

- name: Install package
run: R CMD INSTALL .

- name: Lint
run: lintr::lint_package()
shell: Rscript {0}
17 changes: 14 additions & 3 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, master]
branches:
- '**'
pull_request:
branches:
- '**'
release:
types: [published]
workflow_dispatch:
Expand All @@ -28,9 +32,16 @@ jobs:
extra-packages: any::pkgdown, local::., any::XML
needs: website

- name: Build site
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
- uses: actions/setup-python@v2
with:
python-version: '3.9'

- name: Setup r-reticulate env
run: reticulate::virtualenv_create("r-reticulate", Sys.which("python"))
shell: Rscript {0}

- name: Build site
run: Rscript -e "pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)"

- name: Deploy to GitHub pages
if: github.event_name != 'pull_request'
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/test_macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: "Unit tests: macOS"
on:
push:
branches:
- main
- '**'
pull_request:
branches:
- '**'
Expand All @@ -22,6 +22,10 @@ jobs:

- name: Checkout repository
uses: actions/checkout@v2

- name: Install build dependencies
run: |
brew install curl
- name: Setup R
uses: r-lib/actions/setup-r@v2
Expand Down Expand Up @@ -49,6 +53,7 @@ jobs:
install.packages(c("devtools"))
remotes::install_deps(dependencies = TRUE)
remotes::install_cran("rcmdcheck")
reticulate::install_python(version = "3.9:latest")
shell: Rscript {0}

- name: Check
Expand All @@ -62,4 +67,4 @@ jobs:
- name: Show testthat output
if: always()
run: find check -name 'testthat.Rout*' -exec cat '{}' \; || true
shell: bash
shell: bash
2 changes: 1 addition & 1 deletion .github/workflows/test_ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: "Unit tests: Ubuntu"
on:
push:
branches:
- main
- '**'
pull_request:
branches:
- '**'
Expand Down
29 changes: 22 additions & 7 deletions .github/workflows/test_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@ name: "Unit tests: Windows"
on:
push:
branches:
- main
- '**'
pull_request:
branches:
- '**'

jobs:

test:
name: tests on Windows with R ${{ matrix.R }}
runs-on: windows-latest
Expand All @@ -19,6 +18,13 @@ jobs:
R: [ '4.1.0' ]

steps:
- name: Check Windows architecture
run: |
if (-not [Environment]::Is64BitOperatingSystem) { throw "Not 64-bit Windows" }
Write-Host "OS Architecture: $([Environment]::Is64BitOperatingSystem)"
Write-Host "Process Architecture: $([Environment]::Is64BitProcess)"
systeminfo | findstr /B /C:"OS Name" /C:"OS Version" /C:"System Type"
shell: pwsh

- name: Checkout repository
uses: actions/checkout@v2
Expand All @@ -28,22 +34,31 @@ jobs:
with:
r-version: ${{ matrix.R }}
Ncpus: 2

r-arch: 'x64'

- name: Verify R architecture
run: |
Rscript -e "if(R.version$arch != 'x64') stop('R architecture is not 64-bit!')"
Rscript -e "cat('R Architecture:', R.version$arch, '\n')"
Rscript -e "cat('.Machine$sizeof.pointer:', .Machine$sizeof.pointer, '\n')"
Rscript -e "cat('Using R at:', R.home(), '\n')"
shell: cmd

- name: Query dependencies
run: |
install.packages('remotes')
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
shell: Rscript {0}

- name: cache R installed packages
- name: Cache R packages
uses: actions/[email protected]
id: cache
with:
path: |
${{ env.R_LIBS_USER }}
key: ${{ runner.os }}-R${{ matrix.R }}-2-${{ hashFiles('.github/depends.Rds') }}
restore-keys: ${{ runner.os }}-R${{ matrix.R }}-2-

- name: Install packages
run: |
install.packages(c("devtools"))
Expand All @@ -56,10 +71,10 @@ jobs:
_R_CHECK_CRAN_INCOMING_REMOTE_: false
run: |
options(crayon.enabled = TRUE)
rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "error", check_dir = "check")
rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran" ,'--no-multiarch'), error_on = "error", check_dir = "check")
shell: Rscript {0}

- name: Show testthat output
if: always()
run: find check -name 'testthat.Rout*' -exec cat '{}' \; || true
shell: bash
shell: bash
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,18 @@
# Example code in package build process
*-Ex.R

# Input parameters to simulation
*.json

# Output files from R CMD build
/*.tar.gz

# Output files from R CMD check
/*.Rcheck/

# Output from simulation
*.csv

# RStudio files
.Rproj.user/

Expand Down
39 changes: 24 additions & 15 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,25 +1,34 @@
Package: rEpiabm
Type: Package
Title: R-wrapper of Epiabm
Title: R-Wrapper of Epiabm
Version: 0.0.2
Authors@R: c(
person('Anita', 'Applegarth', role = c('aut', 'cre', 'cph'), email = '[email protected]'),
person('Kingley', 'Oguma', role = 'aut', email = "[email protected]"))
Description: Wraps the epiabm Python module. R users can...
person('Anita', 'Applegarth', role = c('aut', 'cre', 'cph'), email = '[email protected]'),
person('Kingsley', 'Oguma', role = 'aut', email = "[email protected]")
)
Description: Wraps the epiabm Python module in R.
License: BSD_3_clause
Encoding: UTF-8
Archs: x64
SystemRequirements: Python (>= 2.7.0)
Suggests:
tinytest
Depends:
reticulate (>= 1.14),
R (>= 3.3.0)
Suggests: tinytest
Imports:
ggplot2,
here,
tidyr,
reticulate (>= 1.14)
Depends: R (>= 3.3.0)
Config/reticulate:
list(
packages = list(
list(package = "numpy", pip = TRUE),
list(package = "matplotlib", pip = TRUE)
list(
packages = list(
list(package = "numpy", pip = TRUE),
list(package = "pandas", pip = TRUE),
list(package = "matplotlib", pip = TRUE),
list(
package = "pyEpiabm",
pip = TRUE,
pip_options = "--extra-index-url https://github.com/SABS-R3-Epidemiology/epiabm.git@main#egg=pyEpiabm&subdirectory=pyEpiabm"
)
)
)
)

RoxygenNote: 7.3.2
5 changes: 4 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
import(reticulate)
# Generated by roxygen2: do not edit by hand

export(check_python_env)
export(initialize_python_env)
Binary file added R/.DS_Store
Binary file not shown.
1 change: 0 additions & 1 deletion R/blank.R

This file was deleted.

Loading

0 comments on commit dc7935e

Please sign in to comment.