diff --git a/DESCRIPTION b/DESCRIPTION index 81b40d8..4cc560f 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -18,7 +18,9 @@ Imports: logger, mosaic, pkgload, + plotly, R6, + shiny, stats, stringr, tidybayes diff --git a/NAMESPACE b/NAMESPACE index ffe2550..671af35 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -27,4 +27,6 @@ importFrom(ggplot2,ggplot) importFrom(ggplot2,guide_legend) importFrom(ggplot2,guides) importFrom(ggplot2,scale_y_continuous) +importFrom(ggplot2,theme) +importFrom(ggplot2,unit) useDynLib(epikinetics, .registration = TRUE) diff --git a/R/epikinetics-package.R b/R/epikinetics-package.R index 35b5299..e236bbc 100644 --- a/R/epikinetics-package.R +++ b/R/epikinetics-package.R @@ -11,7 +11,7 @@ #' @importFrom data.table .NGRP #' @importFrom data.table .SD #' @importFrom data.table data.table -#' @importFrom ggplot2 aes facet_wrap geom_point geom_ribbon geom_line geom_smooth ggplot guides guide_legend scale_y_continuous +#' @importFrom ggplot2 aes facet_wrap geom_point geom_ribbon geom_line geom_smooth ggplot guides guide_legend scale_y_continuous theme unit #' @useDynLib epikinetics, .registration = TRUE ## usethis namespace: end diff --git a/R/inspect-model.R b/R/inspect-model.R index 50b0c0b..a9f86a9 100644 --- a/R/inspect-model.R +++ b/R/inspect-model.R @@ -150,7 +150,7 @@ inspect_model <- function(mod, private) { } }) - output$data_plot <- renderUI({ + output$data_plot <- shiny::renderUI({ if (nrow(data()) > 0) { plotly::plotlyOutput("data") } else { diff --git a/R/plot.R b/R/plot.R index 949b519..1234754 100644 --- a/R/plot.R +++ b/R/plot.R @@ -86,7 +86,7 @@ plot.biokinetics_population_trajectories <- function(x, ..., data = NULL) { # 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 - day <- last_exp_day <- NULL + day <- last_exp_day <- mu <- .draw <- NULL if (attr(x, "summarised")) { plot <- ggplot(x) + @@ -123,6 +123,9 @@ facet_formula <- function(covariates) { } add_censored_indicator <- function(data) { + # Declare variables to suppress notes when compiling package + # https://github.com/Rdatatable/data.table/issues/850#issuecomment-259466153 + censored <- NULL if (!("censored" %in% colnames(data))) { # censored is an optional column in input data # if not present, treat all points as uncensored diff --git a/R/utils.R b/R/utils.R index fe55f16..fa250a0 100644 --- a/R/utils.R +++ b/R/utils.R @@ -7,13 +7,9 @@ #' @param vars_to_transform Names of columns to apply the transformation to. #' @export convert_log2_scale <- function( - dt_in, vars_to_transform = "value", - simplify_limits = TRUE) { + dt_in, vars_to_transform = "value") { dt_out <- data.table::copy(dt_in) for (var in vars_to_transform) { - if (simplify_limits == TRUE) { - dt_out[get(var) > 2560, (var) := 2560] - } dt_out[, (var) := log2(get(var) / 5)] } return(dt_out) diff --git a/man/convert_log2_scale.Rd b/man/convert_log2_scale.Rd index 1812e87..cea0ce5 100644 --- a/man/convert_log2_scale.Rd +++ b/man/convert_log2_scale.Rd @@ -4,7 +4,7 @@ \alias{convert_log2_scale} \title{Base 2 log scale conversion} \usage{ -convert_log2_scale(dt_in, vars_to_transform = "value", simplify_limits = TRUE) +convert_log2_scale(dt_in, vars_to_transform = "value") } \arguments{ \item{dt_in}{data.table containing data to be transformed from natural to base 2 log scale.}