Nothing
#' Print method for \code{plottedPandemicData} objects
#'
#' The print method for a \code{plottedPandemic} S3 class object displays the single plot or both
#' separated by a prompt for the user.
#'
#' @method print plottedPandemicData
#' @param x An object of S3 class \code{\link{plottedPandemicData-objects}}.
#' @param ... Currently unused.
#' @return Returns \code{x}, invisibly.
#' @details
#' The plots generated by \code{\link{plot.pandemicData}} are displayed by this function
#' If only one of the plots has been generated via the argument \code{cases}, then it is displayed
#' in the Viewer windows as an html object, produced by the \code{\link[plotly]{plot_ly}} function.
#' If both new and cumulative plots are requested, then the new plot is displayed first
#' and a message prompts the user to display the next plot, namely the cumulative one.
#' The plot shows the confirmed cases and the deaths information, but if the user desire to see only one,
#' he can double click on legend to isolate one trace. Consequently, the axis will be automatically configured
#' to the scale of the desired trace. To see both again, the user just need to double click again.
#'
#' @seealso \code{\link{load_covid}} and \code{\link{plot.pandemicData}}
#' @export
print.plottedPandemicData = function(x, ...){
if (!is(x, "plottedPandemicData")) stop("Please use the output of the plot.pandemicData method()")
plotnew = !is.null(x$new)
plotcumulative = !is.null(x$cumulative)
if (!any(plotnew, plotcumulative)) stop("No plots found.")
if (plotnew & plotcumulative){
print(x$new)
cat("\nHit <Return> to see next plot: ")
line <- readline()
print(x$cumulative)
} else if (plotnew) print(x$new) else print(x$cumulative)
cat('\nThe plot shows the confirmed cases and deaths series. Click legend to toggle individual series.\n')
invisible(x)
}
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.