-
Notifications
You must be signed in to change notification settings - Fork 0
Creating default print methods for class sr_model #114
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
Open
sschildhauer
wants to merge
58
commits into
main
Choose a base branch
from
default_print
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 35 commits
Commits
Show all changes
58 commits
Select commit
Hold shift + click to select a range
aea299a
Adding class sero_mod_output to run_mod output
sschildhauer a13db94
Specifying class in run_mod
sschildhauer eef3d8e
creating default print function method for sero_mod_output objects
sschildhauer 147ae9e
Adding S3 method to NameSpace
sschildhauer ea74517
Documentation for default print method
sschildhauer 4af5d36
Merging with main
sschildhauer 102cb80
Creating default print for run_mod objects
sschildhauer 7323fda
Creating a test for default run_mod object print
sschildhauer 88b96af
Updating example for print default
sschildhauer 91a887f
Updating documentation for default print
sschildhauer a7afd63
Arranging data by Iso_type to allow for easy comparison between strat…
sschildhauer f5be2b3
Adding test snap for run_mod object default print
sschildhauer ba5973f
Updating default sr_model print documentation
sschildhauer 4ed27e6
Updating example for print.sr_model
sschildhauer 8e5eba7
Increment version number to 0.0.0.9035
sschildhauer f377d5c
Updating news
sschildhauer 9711df6
Adding print.sr_model to pkgdown
sschildhauer ff9ee85
Deleting a previous default print method that was being created
sschildhauer 8eed4a7
Updating function for pivot_wider
sschildhauer 7a5ec62
Updating documentation to take out old print function
sschildhauer eb4e282
Updating wordlist
sschildhauer 141ba3c
Updating lint
sschildhauer f95a88a
Fixing no lint.
sschildhauer 4dcd890
Updating test lint
sschildhauer ee0a73c
Changing review recommended test code
sschildhauer 0dbc9a2
Updating test code based on review recommendations
sschildhauer a22ed27
Adding .data$ back in to code
sschildhauer 29ec557
Update NEWS.md
sschildhauer 9de64b0
Updating parameter inputs to refelct x, ...
sschildhauer b1d15c4
Fixing column call for taking out Stratification
sschildhauer 0dcac18
Fixing column Stratification exclusion
sschildhauer 86e9965
Changing object call in function to "x"
sschildhauer d97e4b2
Updating test for default print
sschildhauer 3665740
Merge branch 'default_print' of https://github.com/UCD-SERG/serodynam…
sschildhauer afc12a7
Merging with main after plot_predicted_curve update
sschildhauer 42b1810
Increment version number to 0.0.0.9036
sschildhauer 5c9fe1c
Updating visible binding
sschildhauer 1252e18
Merged origin/main into default_print
sschildhauer 9a6931e
Updating output description and documentation
sschildhauer 6dda0ca
Increment version number to 0.0.0.9037
sschildhauer d72bedc
Deleting snap
sschildhauer 26c7800
Updating test and snapshot
sschildhauer 27b1c52
Fixing lint in test
sschildhauer e6b54c1
Fixing for closure
sschildhauer 1657ff1
Fixing data call in if statement
sschildhauer 571bf16
Updating snap.
sschildhauer 95a91c9
making output table a dataframe to get rid of tibble descriptors
sschildhauer 3915ec2
Updating print test
sschildhauer 4233b52
Updating snap
sschildhauer 37f451e
Making model output median value
sschildhauer 3f8c706
Updating test snap
sschildhauer afbb88a
Merge branch 'main' into default_print
sschildhauer ff21aa3
Increment version number to 0.0.0.9038
sschildhauer 47ab5b0
Redoing snap
sschildhauer 0c2a6bd
Updating snap to suppress warnings
sschildhauer 04c7200
Updating snap
sschildhauer 87dd5c7
troubleshooting snap
sschildhauer 9f2fd61
Fixing lint
sschildhauer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#' @title Default print for [serodynamics::run_mod()] output object of class | ||
#' `sr_model` | ||
#' @description | ||
#' A default print method for class `sr_model` that includes the mean posterior | ||
#' distribution for antibody kinetic curve parameters by `Iso_type` and | ||
#' `Stratification` (if specified). | ||
#' @param x An `sr_model` output object from [run_mod()]. | ||
#' @param ... Additional arguments affecting the summary produced. | ||
#' [serodynamics::run_mod()] function. | ||
#' @returns A [dplyr::grouped_df] that | ||
#' contains the mean posterior distribution for antibody kinetic curve | ||
#' parameters by `Iso_type` and `Stratification` (if specified). | ||
#' @export | ||
#' @examples | ||
#' print(nepal_sees_jags_output) | ||
print.sr_model <- function(x, ...) { # nolint | ||
x <- x |> | ||
dplyr::group_by(.data$Stratification, .data$Iso_type, .data$Parameter) |> | ||
dplyr::summarise(mean_val = mean(.data$value)) |> | ||
tidyr::pivot_wider(names_from = .data$Parameter, | ||
values_from = .data$mean_val) |> | ||
dplyr::arrange(.data$Iso_type) | ||
# Taking out stratification column if not specified | ||
if (unique(data$Stratification == "None")) { | ||
x <- x |> select(-all_of(Stratification)) | ||
} | ||
invisible(x) | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
tests/testthat/_snaps/print.sr_model/default-print-runmod-object.csv
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Stratification,Iso_type,alpha,shape,t1,y0,y1 | ||
paratyphi,HlyE_IgA,0.00228672,1.66482,3.85028,2.55072,1024.3 | ||
typhi,HlyE_IgA,0.00290543,1.61299,7.3068,2.9673,1031.9 | ||
paratyphi,HlyE_IgG,0.00256872,1.36053,4.7794,1.72131,833.105 | ||
typhi,HlyE_IgG,0.00153667,1.40846,8.72891,2.31451,338.572 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
test_that( | ||
desc = "results are consistent with printed output for sr_model class", | ||
code = { | ||
withr::local_seed(1) | ||
results <- print(nepal_sees_jags_output) |> | ||
ssdtools:::expect_snapshot("default-print-runmod-object") | ||
|
||
} | ||
) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.