Skip to content

Conversation

@kgoebler
Copy link
Contributor

closes #11

@kgoebler kgoebler requested a review from Copilot August 19, 2025 15:06
@kgoebler kgoebler self-assigned this Aug 19, 2025
@kgoebler kgoebler added the bug Something isn't working label Aug 19, 2025
@kgoebler kgoebler linked an issue Aug 19, 2025 that may be closed by this pull request
Signed-off-by: kgoebler <[email protected]>
@kgoebler kgoebler force-pushed the 11-fix-rpy2-depraction-of-conversion-rules branch from 55d23ed to 20bb5c2 Compare August 19, 2025 15:06
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes rpy2 deprecation warnings by replacing the deprecated activate() conversion methods with the newer localconverter approach. The changes modernize the R interface code to use current rpy2 best practices while maintaining backward compatibility.

  • Replaces deprecated numpy2ri.activate() and pandas2ri.activate() with a local converter pattern
  • Adds automatic installation of the "drf" R package if not present
  • Updates documentation and version number

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
causalAssembly/drf_fitting.py Modernizes rpy2 conversion methods and adds automatic R package installation
VERSION Bumps version from 1.2.0 to 1.2.1
README.md Updates citation and removes manual R package installation requirement

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.


if not rpackages.isinstalled("drf"):
# select a mirror for R packages
utils.chooseCRANmirror(ind=1)
Copy link

Copilot AI Aug 19, 2025

Choose a reason for hiding this comment

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

Hard-coding the CRAN mirror index to 1 is fragile and may fail if that mirror becomes unavailable. Consider using a more robust approach like utils.chooseCRANmirror(graphics=False) which automatically selects an available mirror, or handle potential failures with error handling.

Suggested change
utils.chooseCRANmirror(ind=1)
utils.chooseCRANmirror(graphics=False)

Copilot uses AI. Check for mistakes.
Returns:
np.ndarray: New predicted samlpe of Y.
np.ndarray: New predicted sample of Y.
Copy link

Copilot AI Aug 19, 2025

Choose a reason for hiding this comment

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

There's a spelling error in the comment. 'samlpe' should be 'sample'. This was correctly fixed in the code.

Copilot uses AI. Check for mistakes.
@kgoebler kgoebler merged commit 8da3729 into main Aug 19, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix rpy2 depraction of conversion rules

2 participants