Skip to content

Commit

Permalink
fix plot
Browse files Browse the repository at this point in the history
  • Loading branch information
hillalex committed Oct 23, 2024
1 parent 76ef11a commit efa4635
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Title: Biomarker Kinetics Modelling
Version: 0.0.0.9000
Authors@R: c(person("Timothy", "Russell", email = "[email protected]", role = c("aut")),
person("Alex", "Hill", email = "[email protected]", role = c("aut", "cre")))
Description: Fit kinetic curves to biomarker data, using a Bayesian hierarchical model
Description: Fit kinetic curves to biomarker data, using a Bayesian hierarchical model.
License: GPL (>= 3)
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
Expand Down
10 changes: 4 additions & 6 deletions R/plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ plot_data <- function(data, covariates) {
#' @param x An object of class "biokinetics_population_trajectories". These are
#' generated by running biokinetics$simulate_populate_trajectories(). See
#' \href{../../epikinetics/html/biokinetics.html#method-biokinetics-simulate_population_trajectories}{\code{biokinetics$simulate_population_trajectories()}}
#' @param \dots Further arguments passed to the method. For now the only extra argument supported is "data", which should be
#' a data.table containing raw data as provided to the biokinetics model.
#' @param \dots Further arguments passed to the method.
#' @param data Optional data.table containing raw data as provided to the biokinetics model.
#' @export
plot.biokinetics_population_trajectories <- function(x, ...) {
plot.biokinetics_population_trajectories <- function(x, ..., data = NULL) {
covariates <- attr(x, "covariates")
if (!attr(x, "summarised")) {
by <- setdiff(colnames(x), c("t0_pop", "tp_pop", "ts_pop",
Expand All @@ -84,7 +84,6 @@ plot.biokinetics_population_trajectories <- function(x, ...) {
x <- summarise_draws(
x, column_name = "mu", by = by)
}
args <- list(...)
# Declare variables to suppress notes when compiling package
# https://github.com/Rdatatable/data.table/issues/850#issuecomment-259466153
time_since_last_exp <- value <- me <- titre_type <- lo <- hi <- NULL
Expand All @@ -97,8 +96,7 @@ plot.biokinetics_population_trajectories <- function(x, ...) {
ymax = hi,
fill = titre_type), alpha = 0.5)

if (!is.null(args$data)) {
data <- args$data
if (!is.null(data)) {
validate_required_cols(data)
plot <- plot +
geom_point(data = data,
Expand Down
2 changes: 1 addition & 1 deletion man/epikinetics-package.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions man/plot.biokinetics_population_trajectories.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit efa4635

Please sign in to comment.