-
Notifications
You must be signed in to change notification settings - Fork 0
Add which_mcnode functions to identify nodes with specific conditions #35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: NataliaCiria <114077263+NataliaCiria@users.noreply.github.com>
Co-authored-by: NataliaCiria <114077263+NataliaCiria@users.noreply.github.com>
Co-authored-by: NataliaCiria <114077263+NataliaCiria@users.noreply.github.com>
…sMessages Co-authored-by: NataliaCiria <114077263+NataliaCiria@users.noreply.github.com>
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
NataliaCiria
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want the function to be named "which_mcnode_na()". Additionally, include an equivalent function that checks for inf and -inf values "which_mcnode_inf()". They could be organized in a file called which_mcnode.R and include first a generic which_mcnode() that allows to "sapply" a function through mcmodules that return mcnode names, (for example, which mcnodes are negative), and then use that function to create the NAs and Inf wrappers.
R/mcmodule_nas.R
Outdated
| #' This function identifies which mcnodes within an mcmodule contain NA values. | ||
| #' This is useful for troubleshooting and debugging Monte Carlo models to find | ||
| #' nodes that may be causing issues due to missing or undefined values. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove "This funtion" start with "Identifies..."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated documentation to start with "Identifies..." in commit 485cfbc
R/mcmodule_nas.R
Outdated
| #' @examples | ||
| #' \dontrun{ | ||
| #' # Find nodes with NAs in the imports_mcmodule | ||
| #' mcmodule_nas(imports_mcmodule) | ||
| #' } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Write an actual example, do not use \dontrun
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replaced \dontrun with actual runnable examples in commit 485cfbc. Examples now demonstrate usage with imports_mcmodule and show how to create test mcmodules.
…de_na, add which_mcnode_inf and generic which_mcnode Co-authored-by: NataliaCiria <114077263+NataliaCiria@users.noreply.github.com>
Completed all requested changes in commit 485cfbc:
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:
If you need me to access, download, or install something from one of these locations, you can either:
|
Co-authored-by: NataliaCiria <114077263+NataliaCiria@users.noreply.github.com>
NataliaCiria
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The functions look good, but mcnodes in the examples and tests must be created with mcdata() or mcstoc(), they are not vectors or matrices. Check other tests in the package.
…ode creation Co-authored-by: NataliaCiria <114077263+NataliaCiria@users.noreply.github.com>
Updated all examples and tests to use 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:
If you need me to access, download, or install something from one of these locations, you can either:
|
Co-authored-by: NataliaCiria <114077263+NataliaCiria@users.noreply.github.com>
Add which_mcnode functions to identify nodes with specific conditions
Changes Made (addressing all PR feedback):
mcmodule_nas()towhich_mcnode_na()which_mcnode()function for custom conditionswhich_mcnode_inf()to detect infinite valueswhich_mcnode.Rfile\dontrunwith actual runnable examplesmcdata()directly for creating mcnodes with NA/Inf valuesNew Functions:
which_mcnode(mcmodule, test_func)- Generic function to find nodes matching any conditionwhich_mcnode_na(mcmodule)- Finds nodes containing NA valueswhich_mcnode_inf(mcmodule)- Finds nodes containing Inf or -Inf valuesFiles Changed:
R/mcmodule_nas.R,tests/testthat/test-mcmodule_nas.R,man/mcmodule_nas.RdR/which_mcnode.R,tests/testthat/test-which_mcnode.Rman/which_mcnode.Rd,man/which_mcnode_na.Rd,man/which_mcnode_inf.RdNAMESPACETesting:
✅ Examples use
mcdata()directly for simple mcnode creation✅ Tests use
mcdata()to create mcnodes with specific values (NA, Inf, etc.)✅ Follows package conventions while being more straightforward than using
mcstoc(runif, ...)Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.