Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .devcontainer/Dockerfile → .devcontainer/Containerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
FROM rocker/tidyverse:4.4.0
FROM ghcr.io/rocker-org/devcontainer/tidyverse:4.5

# RUN \
# echo 'options(repos=c(CRAN="https://packagemanager.posit.co/cran/__linux__/bookworm/latest"))' >> ~/.Rprofile && \
# Rscript --vanilla -e 'getOption("repos")'

# Adding R packages
RUN install2.r Rcpp sna network networkDynamic Matrix MASS MatchIt SparseM igraph \
viridisLite covr testthat knitr rmarkdown ape RSiena survival RcppArmadillo

RUN install2.r languageserver httpgd
RUN install2.r --error languageserver && installGithub.r nx10/httpgd

RUN apt-get update && apt-get install --no-install-recommends -y valgrind gdb \
libglpk-dev

# Adding R packages
RUN install2.r --error Rcpp sna network networkDynamic Matrix MASS MatchIt SparseM igraph \
viridisLite covr testthat knitr rmarkdown ape RSiena survival RcppArmadillo

CMD ["bash"]
11 changes: 6 additions & 5 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/cpp
{
"name": "epiworldR",
"name": "netdiffuseR",
"build": {
"dockerfile": "Dockerfile"
"dockerfile": "Containerfile"
},
"customizations": {
"vscode": {
"extensions": [
"reditorsupport.r",
"rdebugger.r-debugger",
"quarto.quarto",
"tianyishi.rmarkdown"
"tianyishi.rmarkdown",
"github.vscode-github-actions"
]
}
},
"mounts": [
// Mount the .vscode configuration into the container
"source=${localWorkspaceFolder}/.devcontainer/.vscode,target=/workspaces/${localWorkspaceFolderBasename}/.vscode,type=bind,consistency=cached"
]
],
// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},

Expand All @@ -32,5 +33,5 @@
// "customizations": {},

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
"remoteUser": "root"
}
30 changes: 30 additions & 0 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Copilot Instructions for netdiffuseR

## Documentation Style

When writing roxygen2 documentation, prefer markdown syntax over LaTeX:

- Use `` `code` `` instead of `\code{code}`
- Use `` `[function()]` `` instead of `\code{\link{function}}`
- Use markdown bullet lists instead of `\itemize{}`
- Use markdown formatting for emphasis and structure

## Code Style

- Follow existing code patterns and conventions in the package
- Use meaningful variable names and keep functions focused
- Add comments only when they match the existing style or explain complex logic
- Prefer using existing libraries over adding new dependencies

## Testing

- Add comprehensive tests for new functions
- Include edge cases and error conditions
- Test with the existing sample datasets when possible
- Validate input parameters and handle errors gracefully

## Examples

- Use `\dontrun{}` only when examples take a long time to run
- Prefer examples that can execute quickly for CRAN checks
- Use existing package datasets in examples when available
6 changes: 4 additions & 2 deletions .github/workflows/pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
id-token: write
pages: write
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5

- uses: r-lib/actions/setup-pandoc@v2
with:
Expand All @@ -35,6 +35,8 @@ jobs:
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::pkgdown
install-quarto: true
install-pandoc: true

- name: Install the package
run: R CMD INSTALL .
Expand All @@ -44,7 +46,7 @@ jobs:
shell: Rscript {0}

- name: Upload artifact for GH pages deployment
uses: actions/upload-pages-artifact@v3
uses: actions/upload-pages-artifact@v5
with:
path: "docs/"

Expand Down
68 changes: 41 additions & 27 deletions .github/workflows/r.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,16 @@ jobs:
R-CMD-check:
runs-on: ${{ matrix.config.os }}

name: ${{ matrix.config.os }} (${{ matrix.config.r }})
name: ${{ matrix.config.os }} (${{ matrix.config.r }}) (valgrind:${{ matrix.config.valgrind }})

strategy:
fail-fast: false
matrix:
config:
- {os: macOS-latest, r: 'release'}
- {os: macOS-latest, r: 'devel', http-user-agent: 'release'}
- {os: windows-latest, r: 'release'}
# - {os: windows-latest, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-latest, r: 'release'}
- {os: ubuntu-latest, r: 'devel', valgrind: true, http-user-agent: 'release'}
Expand All @@ -32,9 +34,12 @@ jobs:
R_KEEP_PKG_SOURCE: yes

steps:
- uses: actions/checkout@v4
# Fix suggested by
# https://msmith.de/2020/03/12/r-cmd-check-github-actions.html
- name: Configure git
run: git config --global core.autocrlf false

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

- uses: r-lib/actions/setup-r@v2
with:
Expand All @@ -46,6 +51,8 @@ jobs:
with:
extra-packages: any::rcmdcheck
needs: check
install-quarto: true
install-pandoc: true

- uses: r-lib/actions/check-r-package@v2
if: ${{ matrix.config.valgrind != true }}
Expand All @@ -56,36 +63,43 @@ jobs:
check-dir: '"check"'
error-on: '"error"'

- name: Setup valgrind
if: ${{ matrix.config.valgrind == true }}
- name: Install valgrind
if: ${{ matrix.config.valgrind }}
run: |
sudo apt-get update
sudo apt-get install -y valgrind --no-install-recommends
shell: bash
sudo apt-get install -y --no-install-recommends valgrind

- name: Check with Valgrind
if: ${{ matrix.config.valgrind == true }}
env:
_R_CHECK_CRAN_INCOMING_REMOTE_: false
run: |
options(crayon.enabled = TRUE)
rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran", "--use-valgrind"), error_on = "error", check_dir = "check")
shell: Rscript {0}
- uses: r-lib/actions/check-r-package@v2
if: ${{ matrix.config.valgrind }}
with:
args: 'c("--as-cran", "--use-valgrind", "--no-manual")'
upload-results: true

build-pkg:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5

- name: Upload check results
if: failure()
uses: actions/upload-artifact@main
- uses: r-lib/actions/setup-r@v2
with:
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
path: check
r-version: 'release'
use-public-rspm: true

- name: Build the package
if: ${{ matrix.config.os == 'ubuntu-latest' && (matrix.config.r == 'release' || matrix.config.r == 'devel') && (matrix.config.valgrind != true) }}
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::devtools

- name: Build package
run: R CMD build .

- uses: actions/upload-artifact@v4
if: ${{ matrix.config.os == 'ubuntu-latest' && (matrix.config.r == 'release' || matrix.config.r == 'devel') && (matrix.config.valgrind != true) }}
- name: Upload package artifact
uses: actions/upload-artifact@v5
with:
name: netdiffuseR-built-package-${{ matrix.config.os }}-${{ matrix.config.r }}
path: netdiffuseR_*.tar.gz
retention-days: 7
name: R-package
path: '*.tar.gz'






5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,8 @@ inst/doc
*.tex
playground/
doc/

# Other files
.vscode/
config.status
src/Makevars
5 changes: 3 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: netdiffuseR
Title: Analysis of Diffusion and Contagion Processes on Networks
Version: 1.23.0
Version: 1.24.0
Authors@R: c(
person("George", "Vega Yon", email="g.vegayon@gmail.com", role=c("aut", "cre"),
comment=c(ORCID = "0000-0002-3171-0844", what="Rewrite functions with Rcpp, plus new features")
Expand Down Expand Up @@ -51,7 +51,7 @@ Suggests:
survival
VignetteBuilder: knitr
LinkingTo: Rcpp, RcppArmadillo
RoxygenNote: 7.3.2
RoxygenNote: 7.3.3
Encoding: UTF-8
URL: https://github.com/USCCANA/netdiffuseR,
https://USCCANA.github.io/netdiffuseR/
Expand All @@ -66,6 +66,7 @@ Collate:
'bootnet.r'
'citer_environment.R'
'data.r'
'degree_adoption_diagnostic.R'
'diffnet-c.R'
'diffnet-class.r'
'diffnet-indexing.r'
Expand Down
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ help:
@echo " make docs - Generate documentation"

install:
R CMD INSTALL .
Rscript --vanilla -e 'devtools::install()'

build:
R CMD build .

README.md: README.Rmd
Rscript -e 'rmarkdown::render("README.Rmd")'
README.md: README.qmd
quarto render README.qmd

check: netdiffuseR_$(VERSION).tar.gz
R CMD check --as-cran netdiffuseR_$(VERSION).tar.gz
check:
Rscript --vanilla -e 'devtools::check()'

checkv: netdiffuseR_$(VERSION).tar.gz
R CMD check --as-cran --use-valgrind netdiffuseR_$(VERSION).tar.gz
Expand Down
2 changes: 2 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ S3method(plot_diffnet2,diffnet)
S3method(plot_threshold,array)
S3method(plot_threshold,default)
S3method(plot_threshold,diffnet)
S3method(print,degree_adoption_diagnostic)
S3method(print,diffnet)
S3method(print,diffnet_bootnet)
S3method(print,diffnet_diffmap)
Expand Down Expand Up @@ -99,6 +100,7 @@ export(classify_adopters)
export(classify_graph)
export(compare_matrix)
export(cumulative_adopt_count)
export(degree_adoption_diagnostic)
export(dgr)
export(diag_expand)
export(diffmap)
Expand Down
8 changes: 8 additions & 0 deletions NEWS.md
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to fill in the blanks. Ensure to add what's new from this version vs the previous one. You can use GitHub to compare differences and perhaps update the NEWS. LMK if you need help with that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated NEWS.md to document the new degree_adoption_diagnostic() function in version 1.24.0 (DEV). The entry was moved from v1.23.0 and expanded to include details about multi-diffusion support, undirected networks, and bootstrap confidence intervals. See commit 59d54b3.

Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# Changes in netdiffuseR version 1.24.0 (DEV)

* New function `degree_adoption_diagnostic()` analyzes the correlation between network
centrality measures (in-degree and out-degree) and time of adoption to identify
whether opinion leaders were supporters or opposers in diffusion processes.
The function supports multi-diffusion objects, undirected networks, and includes
bootstrap confidence intervals.

# Changes in netdiffuseR version 1.23.0 (2025-06-10)

* New methods for simulating multi-diffusion models.
Expand Down
Loading
Loading