Skip to content

Conversation

Copy link

Copilot AI commented Sep 29, 2025

This PR fixes CRAN package check warnings caused by deprecated arma::is_finite() function calls in the C++ code. The warnings were appearing across multiple R platforms and preventing successful CRAN submission.

Issue

CRAN checks were failing with deprecation warnings:

infection.cpp:58:25: warning: 'bool arma::is_finite(eT, const typename arma_scalar_only<eT>::result*) [with eT = double]' is deprecated: change arma::is_finite(val) to std::isfinite(val) [-Wdeprecated-declarations]

Changes

  • Added #include <cmath> header to src/infection.cpp to support std::isfinite()
  • Replaced arma::is_finite(times(i)) with std::isfinite(times(i)) at two locations:
    • Line 59 in infection_cpp() function
    • Line 163 in susceptibility_cpp() function

Testing

  • Verified C++ code compiles successfully with sourceCpp()
  • Confirmed std::isfinite() has identical behavior to arma::is_finite() for finite/NaN/infinite values
  • No breaking changes - both functions serve the same purpose of checking if a value is finite

This minimal change addresses the exact deprecation warnings specified by CRAN and should allow the package to pass all checks for resubmission.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • cloud.r-project.org
    • Triggering command: /usr/lib/R/bin/exec/R -e .libPaths(&#39;~/R/library&#39;);~&#43;~install.packages(c(&#39;Rcpp&#39;,~&#43;~&#39;RcppArmadillo&#39;),~&#43;~repos=&#39;REDACTED&#39;) (dns block)
  • esm.ubuntu.com
    • Triggering command: /usr/lib/apt/methods/https (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Fix issues associated with Rcpp</issue_title>
<issue_description>I recently got this email from CRAN about the R package. We need to fix the issues associated with the changes in the Rcpp package to resubmit the package to CRAN.

Dear maintainer,

Please see the problems shown on
https://cran.r-project.org/web/checks/check_results_netdiffuseR.html.

Specifically, please see the compilation warnings about deprecated
declarations.

These are from a recent upgrade of RcppArmadillo which now uses
Armadillo 15 by default. See
RcppCore/RcppArmadillo#485 for more
information.

Please correct before 2025-10-23 to safely retain your package on CRAN.

Best wishes,
The CRAN Team

More details

<h2 style="background: white; color: rgb(102, 102, 102); font-family: monospace; font-size: large; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">CRAN Package Check Results for Package<span> </span><a href="https://cran.r-project.org/web/packages/netdiffuseR/index.html" style="background: white; color: blue;"><span class="CRAN" style="color: rgb(39, 109, 195); text-decoration: underline;">netdiffuseR</span></a></h2><p style="color: rgb(0, 0, 0); font-family: Times; font-size: medium; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">Last updated on 2025-09-29 16:49:55 CEST.</p>
Flavor | Version | Tinstall | Tcheck | Ttotal | Status | Flags
-- | -- | -- | -- | -- | -- | --
r-devel-linux-x86_64-debian-clang | 1.23.0 | 102.60 | 335.19 | 437.79 | WARN |  
r-devel-linux-x86_64-debian-gcc | 1.23.0 | 71.35 | 211.72 | 283.07 | WARN |  
r-devel-linux-x86_64-fedora-clang | 1.23.0 |   |   | 726.03 | WARN |  
r-devel-linux-x86_64-fedora-gcc | 1.23.0 |   |   | 703.81 | WARN |  
r-devel-windows-x86_64 | 1.23.0 | 128.00 | 261.00 | 389.00 | WARN | --no-vignettes
r-patched-linux-x86_64 | 1.23.0 | 110.31 | 310.09 | 420.40 | WARN |  
r-release-linux-x86_64 | 1.23.0 | 110.21 | 309.67 | 419.88 | WARN |  
r-release-macos-arm64 | 1.23.0 |   |   | 145.00 | OK |  
r-release-macos-x86_64 | 1.23.0 |   |   | 260.00 | OK |  
r-release-windows-x86_64 | 1.23.0 | 126.00 | 216.00 | 342.00 | WARN | --no-vignettes
r-oldrel-macos-arm64 | 1.23.0 |   |   | 162.00 | NOTE |  
r-oldrel-macos-x86_64 | 1.23.0 |   |   | 265.00 | NOTE |  
r-oldrel-windows-x86_64 | 1.23.0 | 154.00 | 262.00 | 416.00 | WARN | --no-vignettes

<h3 style="background: white; color: rgb(102, 102, 102); font-family: monospace; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">Check Details</h3><p style="color: rgb(0, 0, 0); font-family: Times; font-size: medium; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">Version: 1.23.0<br>Check: whether package can be installed<br>Result: WARN<span> </span><span style="font-family: monospace; white-space: pre;">
  Found the following significant warnings:
    infection.cpp:58:16: warning: 'is_finite&lt;double&gt;' is deprecated: change arma::is_finite(val) to std::isfinite(val) [-Wdeprecated-declarations]
    infection.cpp:162:16: warning: 'is_finite&lt;double&gt;' is deprecated: change arma::is_finite(val) to std::isfinite(val) [-Wdeprecated-declarations]
  See ‘/home/hornik/tmp/R.check/r-devel-clang/Work/PKGS/netdiffuseR.Rcheck/00install.out’ for details.
  * used C++ compiler: ‘Debian clang version 19.1.7 (3+b2)’
</span>Flavor:<span> </span><a href="https://www.r-project.org/nosvn/R.check/r-...

</details>
Fixes USCCANA/netdiffuseR#59

<!-- START COPILOT CODING AGENT TIPS -->
---

✨ Let Copilot coding agent [set things up for you](https://github.com/USCCANA/netdiffuseR/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Fix issues associated with Rcpp Fix deprecated arma::is_finite calls to resolve CRAN warnings Sep 29, 2025
Copilot AI requested a review from gvegayon September 29, 2025 16:00
Copilot finished work on behalf of gvegayon September 29, 2025 16:00
@gvegayon gvegayon marked this pull request as ready for review September 29, 2025 16:16
@gvegayon gvegayon linked an issue Sep 29, 2025 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix issues associated with Rcpp

2 participants