Skip to content

Commit f656013

Browse files
authored
Preparing for CRAN release (#54)
* Mostly refactoring and code cleaning * Cleaning * Reverting change to graph_data.r * Still a warning around plot_threshold method * Adding citer * Adding citer environment * Fixing plot_threshold * Fixing issue about threshold * Fixing citations * Adding qmd files to buildignore * Better warnings * Trying to address issues from CRAN * Using valgrind * Checking with valgrind * Adding citer properly * Adding artifact for automatic build
1 parent 1efc0be commit f656013

36 files changed

+595
-898
lines changed

.Rbuildignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
.*\.doc
1919
.*\.pdf
2020
# Misc
21-
README[.]Rmd
21+
README[.](R|q)md
2222
^README\_files$
2323
[.]travis[.]yml
2424
^appveyor\.yml$
@@ -39,4 +39,5 @@ makefile
3939
^netdiffuseR\.tar\.gz$
4040
^\.github
4141
netdiffuseR\.Rcheck
42-
42+
^\.devcontainer$
43+
^\.vscode$
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"r.plot.useHttpgd": true,
3+
"r.alwaysUseActiveTerminal": true
4+
}

.devcontainer/Dockerfile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
FROM rocker/tidyverse:4.4.0
2+
3+
# RUN \
4+
# echo 'options(repos=c(CRAN="https://packagemanager.posit.co/cran/__linux__/bookworm/latest"))' >> ~/.Rprofile && \
5+
# Rscript --vanilla -e 'getOption("repos")'
6+
7+
# Adding R packages
8+
RUN install2.r Rcpp sna network networkDynamic Matrix MASS MatchIt SparseM igraph \
9+
viridisLite covr testthat knitr rmarkdown ape RSiena survival RcppArmadillo
10+
11+
RUN install2.r languageserver httpgd
12+
13+
RUN apt-get update && apt-get install --no-install-recommends -y valgrind gdb \
14+
libglpk-dev
15+
16+
CMD ["bash"]

.devcontainer/devcontainer.json

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
2+
// README at: https://github.com/devcontainers/templates/tree/main/src/cpp
3+
{
4+
"name": "epiworldR",
5+
"build": {
6+
"dockerfile": "Dockerfile"
7+
},
8+
"customizations": {
9+
"vscode": {
10+
"extensions": [
11+
"reditorsupport.r",
12+
"rdebugger.r-debugger",
13+
"quarto.quarto",
14+
"tianyishi.rmarkdown"
15+
]
16+
}
17+
},
18+
"mounts": [
19+
// Mount the .vscode configuration into the container
20+
"source=${localWorkspaceFolder}/.devcontainer/.vscode,target=/workspaces/${localWorkspaceFolderBasename}/.vscode,type=bind,consistency=cached"
21+
]
22+
// Features to add to the dev container. More info: https://containers.dev/features.
23+
// "features": {},
24+
25+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
26+
// "forwardPorts": [],
27+
28+
// Use 'postCreateCommand' to run commands after the container is created.
29+
// "postCreateCommand": "gcc -v",
30+
31+
// Configure tool-specific properties.
32+
// "customizations": {},
33+
34+
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
35+
// "remoteUser": "root"
36+
}

.github/workflows/r.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ jobs:
2626
- {os: macOS-latest, r: 'release'}
2727
- {os: ubuntu-latest, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
2828
- {os: ubuntu-latest, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
29+
- {os: ubuntu-latest, r: 'devel', valgrind: true, rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
2930

3031
env:
3132
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
@@ -70,16 +71,44 @@ jobs:
7071
shell: Rscript {0}
7172

7273
- name: Check
74+
if: ${{ matrix.config.valgrind != true }}
7375
env:
7476
_R_CHECK_CRAN_INCOMING_REMOTE_: false
7577
run: |
7678
options(crayon.enabled = TRUE)
7779
rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "error", check_dir = "check")
7880
shell: Rscript {0}
7981

82+
- name: Setup valgrind
83+
if: ${{ matrix.config.valgrind == true }}
84+
run: |
85+
sudo apt-get update
86+
sudo apt-get install -y valgrind --no-install-recommends
87+
shell: bash
88+
89+
- name: Check with Valgrind
90+
if: ${{ matrix.config.valgrind == true }}
91+
env:
92+
_R_CHECK_CRAN_INCOMING_REMOTE_: false
93+
run: |
94+
options(crayon.enabled = TRUE)
95+
rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran", "--use-valgrind"), error_on = "error", check_dir = "check")
96+
shell: Rscript {0}
97+
8098
- name: Upload check results
8199
if: failure()
82100
uses: actions/upload-artifact@main
83101
with:
84102
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
85103
path: check
104+
105+
- name: Build the package
106+
if: ${{ matrix.config.os == 'ubuntu-latest' && (matrix.config.r == 'release' || matrix.config.r == 'devel') && (matrix.config.valgrind != true) }}
107+
run: R CMD build .
108+
109+
- uses: actions/upload-artifact@v4
110+
if: ${{ matrix.config.os == 'ubuntu-latest' && (matrix.config.r == 'release' || matrix.config.r == 'devel') && (matrix.config.valgrind != true) }}
111+
with:
112+
name: netdiffuseR-built-package-${{ matrix.config.os }}-${{ matrix.config.r }}
113+
path: netdiffuseR_*.tar.gz
114+
retention-days: 7

DESCRIPTION

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: netdiffuseR
22
Title: Analysis of Diffusion and Contagion Processes on Networks
3-
Version: 1.22.7
3+
Version: 1.23.0
44
Authors@R: c(
55
person("George", "Vega Yon", email="[email protected]", role=c("aut", "cre"),
66
comment=c(ORCID = "0000-0002-3171-0844", what="Rewrite functions with Rcpp, plus new features")
@@ -51,7 +51,7 @@ Suggests:
5151
survival
5252
VignetteBuilder: knitr
5353
LinkingTo: Rcpp, RcppArmadillo
54-
RoxygenNote: 7.3.1
54+
RoxygenNote: 7.3.2
5555
Encoding: UTF-8
5656
URL: https://github.com/USCCANA/netdiffuseR,
5757
https://USCCANA.github.io/netdiffuseR/
@@ -64,6 +64,7 @@ Collate:
6464
'adjmat.r'
6565
'bass.r'
6666
'bootnet.r'
67+
'citer_environment.R'
6768
'data.r'
6869
'diffnet-c.R'
6970
'diffnet-class.r'

Makefile

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,32 @@
1-
VERSION:=$(shell Rscript -e 'x<-readLines("DESCRIPTION");cat(gsub(".+[:]\\s*", "", x[grepl("^Vers", x)]))')
2-
3-
install: netdiffuseR_$(VERSION).tar.gz
4-
R CMD INSTALL netdiffuseR_$(VERSION).tar.gz
5-
6-
netdiffuseR_$(VERSION).tar.gz: */*.R inst/NEWS README.md
1+
help:
2+
@echo "Makefile for netdiffuseR package"
3+
@echo "Usage:"
4+
@echo " make install - Install the package"
5+
@echo " make build - Build the package source tarball"
6+
@echo " make check - Check the package with R CMD check"
7+
@echo " make checkv - Check the package with R CMD check using Valgrind"
8+
@echo " make clean - Clean up the build artifacts"
9+
@echo " make docs - Generate documentation"
10+
11+
install:
12+
R CMD INSTALL .
13+
14+
build:
715
R CMD build .
816

9-
inst/NEWS: NEWS.md
10-
Rscript -e "rmarkdown::pandoc_convert('NEWS.md', 'plain', output='inst/NEWS')"&& \
11-
head -n 80 inst/NEWS
12-
1317
README.md: README.Rmd
1418
Rscript -e 'rmarkdown::render("README.Rmd")'
1519

16-
.PHONY: check checkv clean
17-
1820
check: netdiffuseR_$(VERSION).tar.gz
1921
R CMD check --as-cran netdiffuseR_$(VERSION).tar.gz
2022

2123
checkv: netdiffuseR_$(VERSION).tar.gz
2224
R CMD check --as-cran --use-valgrind netdiffuseR_$(VERSION).tar.gz
2325

2426
clean:
25-
rm -rf netdiffuseR.Rcheck
27+
rm -rf netdiffuseR.Rcheck src/*.so src/*.o
2628

27-
man/moran.Rd: R/* src/*.cpp src/*.h
28-
Rscript --vanilla -e 'roxygen2::roxygenize()'
29+
docs:
30+
Rscript --vanilla -e 'devtools::document()'
2931

32+
.PHONY: check checkv clean install docs

NEWS.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
# Changes in netdiffuseR version 1.23.0 (2025-06-10)
2+
3+
* New methods for simulating multi-diffusion models.
4+
5+
* It is now possible to simulate diffusions with general disadoption functions.
6+
7+
18
# Changes in netdiffuseR version 1.22.7 (2024-09-18)
29

310
* Minor changes to testing (skip warnings).

R/citer_environment.R

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# file_version: f6ffa5cc103728c81c977e9101df287d
2+
# citer_version: 0.0.9000
3+
# DO NOT EDIT THIS BY HAND!
4+
# This document was automatically generated by the `citer` package.
5+
# tools::md5sum()
6+
7+
# Citer Environment Setup
8+
citation_on_load <- function() {
9+
10+
pkg_name <- "netdiffuseR"
11+
12+
packageStartupMessage(
13+
"Thank you for using ", pkg_name, "! ",
14+
"Please consider citing it in your work.\n",
15+
"You can find the citation information by running\n citation(\"",
16+
pkg_name,
17+
"\")"
18+
)
19+
20+
}

0 commit comments

Comments
 (0)