From 0409143d94862d4e6b6b368cc98f769944e75566 Mon Sep 17 00:00:00 2001 From: pqiao29 <pqiao@student.unimelb.edu.au> Date: Thu, 16 Apr 2020 18:32:37 +1000 Subject: [PATCH] fix check warnings --- NAMESPACE | 4 ++-- R/FIN_plot.R | 34 ++++++++++++++++++---------------- R/original_plot_models.R | 1 - man/add_known.Rd | 6 ++++-- man/format_sims.Rd | 2 +- man/get_ci.Rd | 2 +- man/plot_sirplus.Rd | 18 +++++++++--------- 7 files changed, 35 insertions(+), 32 deletions(-) diff --git a/NAMESPACE b/NAMESPACE index fb6c891..3025c5a 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -28,9 +28,7 @@ export(recovery.FUN) export(seiqhrf) export(simulate_seiqhrf) export(vary_param) -import(dplyr) import(ggplot2) -import(lubridate) importFrom(EpiModel,get_prev.icm) importFrom(EpiModel,ssample) importFrom(EpiModel,verbose.icm) @@ -39,11 +37,13 @@ importFrom(dplyr,"%>%") importFrom(dplyr,between) importFrom(dplyr,bind_rows) importFrom(dplyr,filter) +importFrom(dplyr,full_join) importFrom(dplyr,mutate) importFrom(dplyr,select) importFrom(foreach,"%dopar%") importFrom(foreach,foreach) importFrom(future,availableCores) +importFrom(lubridate,ymd) importFrom(stats,pweibull) importFrom(stats,rbinom) importFrom(stats,rgeom) diff --git a/R/FIN_plot.R b/R/FIN_plot.R index 1233111..508b8a6 100644 --- a/R/FIN_plot.R +++ b/R/FIN_plot.R @@ -32,7 +32,7 @@ #' @importFrom dplyr bind_rows #' @importFrom dplyr select #' @importFrom dplyr filter -#' @import lubridate +#' @importFrom lubridate ymd #' @import ggplot2 #' @export plot.seiqhrf <- function(x, method = NULL, @@ -104,7 +104,7 @@ plot.seiqhrf <- function(x, method = NULL, #' @importFrom dplyr bind_rows #' @importFrom dplyr select #' @importFrom dplyr filter -#' @import lubridate +#' @importFrom lubridate ymd #' @import ggplot2 #' @export plot.list <- function(x, comp_remove = "none", @@ -165,15 +165,15 @@ plot.list <- function(x, comp_remove = "none", #' @importFrom dplyr filter #' @import ggplot2 #' @export -plot_sirplus <- function(x, comp_remove = comp_remove, - time_lim = time_lim, - ci = ci, - sep_compartments = sep_compartments, - trans = trans, - known = known, - start_date = start_date, - x_axis = x_axis, - plot_title = plot_title, ...){ +plot_sirplus <- function(x, comp_remove, + time_lim, + ci, + sep_compartments, + trans, + known, + start_date, + x_axis, + plot_title, ...){ # Convert from seiqhrf object to dataframe plot_df <- format_sims(x, time_lim = time_lim, start_date = start_date) @@ -306,7 +306,7 @@ plot_times <- function(sim) { #' @return dataframe #' #' @export -format_sims <- function(x, time_lim = time_lim, start_date = start_date){ +format_sims <- function(x, time_lim, start_date){ # Merge models to plot together if(class(x) == "seiqhrf"){ @@ -343,11 +343,12 @@ format_sims <- function(x, time_lim = time_lim, start_date = start_date){ #' Get 95\% confidence intervals #' #' @param x An seiqhrf object returned from function \code{\link{seiqhrf}}. -#' @param known Dataframe with known compartment numbers to plot alongside +#' @param plot_df Dataframe with known compartment numbers to plot alongside #' projections #' #' @return dataframe with CIs and sd added #' @importFrom tidyr separate +#' @importFrom dplyr full_join #' #' @export #' @@ -404,22 +405,23 @@ get_ci <- function(x, plot_df){ ci_info[is.na(ci_info)] <- 0 plot_df <- plot_df %>% - full_join(ci_info, by = c('time', 'compartment', 'experiment', 'sim')) + dplyr::full_join(ci_info, by = c('time', 'compartment', 'experiment', 'sim')) return(plot_df) } #' Add known counts to sims dataframe for ggplot #' -#' @param x An seiqhrf object returned from function \code{\link{seiqhrf}}. +#' @param plot_df An seiqhrf object returned from function \code{\link{seiqhrf}}. #' @param known Dataframe with known compartment numbers to plot alongside #' projections +#' @param start_date Date for day 0. #' #' @return dataframe with known data added #' #' @export #' -add_known <- function(plot_df, known = known, start_date = start_date){ +add_known <- function(plot_df, known, start_date){ # Add Date to known data missing_cols <- setdiff(names(plot_df), names(known)) diff --git a/R/original_plot_models.R b/R/original_plot_models.R index 74a1a20..049b888 100644 --- a/R/original_plot_models.R +++ b/R/original_plot_models.R @@ -15,7 +15,6 @@ #' #' @return ggplot2 object #' -#' @import dplyr #' @importFrom tidyr pivot_longer plot_models <- function(sims = baseline_sim, diff --git a/man/add_known.Rd b/man/add_known.Rd index 5369f4e..2f3af39 100644 --- a/man/add_known.Rd +++ b/man/add_known.Rd @@ -4,13 +4,15 @@ \alias{add_known} \title{Add known counts to sims dataframe for ggplot} \usage{ -add_known(plot_df, known = known, start_date = start_date) +add_known(plot_df, known, start_date) } \arguments{ +\item{plot_df}{An seiqhrf object returned from function \code{\link{seiqhrf}}.} + \item{known}{Dataframe with known compartment numbers to plot alongside projections} -\item{x}{An seiqhrf object returned from function \code{\link{seiqhrf}}.} +\item{start_date}{Date for day 0.} } \value{ dataframe with known data added diff --git a/man/format_sims.Rd b/man/format_sims.Rd index 7bdc033..9a3735f 100644 --- a/man/format_sims.Rd +++ b/man/format_sims.Rd @@ -4,7 +4,7 @@ \alias{format_sims} \title{Format seiqhrf objects into dataframe for ggplot} \usage{ -format_sims(x, time_lim = time_lim, start_date = start_date) +format_sims(x, time_lim, start_date) } \arguments{ \item{x}{An seiqhrf object returned from function \code{\link{seiqhrf}}.} diff --git a/man/get_ci.Rd b/man/get_ci.Rd index 005e0af..faee92f 100644 --- a/man/get_ci.Rd +++ b/man/get_ci.Rd @@ -9,7 +9,7 @@ get_ci(x, plot_df) \arguments{ \item{x}{An seiqhrf object returned from function \code{\link{seiqhrf}}.} -\item{known}{Dataframe with known compartment numbers to plot alongside +\item{plot_df}{Dataframe with known compartment numbers to plot alongside projections} } \value{ diff --git a/man/plot_sirplus.Rd b/man/plot_sirplus.Rd index 408aa3b..24e9f70 100644 --- a/man/plot_sirplus.Rd +++ b/man/plot_sirplus.Rd @@ -6,15 +6,15 @@ \usage{ plot_sirplus( x, - comp_remove = comp_remove, - time_lim = time_lim, - ci = ci, - sep_compartments = sep_compartments, - trans = trans, - known = known, - start_date = start_date, - x_axis = x_axis, - plot_title = plot_title, + comp_remove, + time_lim, + ci, + sep_compartments, + trans, + known, + start_date, + x_axis, + plot_title, ... ) } -- GitLab