% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/plotly_exp_duration.R
\name{plotly_exp_duration}
\alias{plotly_exp_duration}
\title{Create an interactive plot for exposure duration}
\usage{
plotly_exp_duration(
  outdata,
  color = NULL,
  display = c("n", "prop"),
  display_total = TRUE,
  display_standard_histogram = TRUE,
  standard_histogram_label =
    "Comparison of Exposure Duration (> = x days) by Treatment Groups",
  display_stacked_histogram = TRUE,
  stacked_histogram_label =
    "Comparison of Exposure Duration (> = x days and < y days) by Treatment Groups",
  display_horizontal_histogram = TRUE,
  horizontal_histogram_label = "Comparison by Exposure Duration (> = x days)",
  plot_group_label = "Treatment group",
  plot_category_label = "Exposure duration",
  hover_summary_var = c("n", "median", "sd", "se", "median", "min", "max", "q1 to q3",
    "range"),
  width = 1000,
  height = 400
)
}
\arguments{
\item{outdata}{An \code{outdata} object created from \code{prepare_exp_duration()}.
\code{extend_exp_duration()} can also be applied.}

\item{color}{Color for a histogram.}

\item{display}{A character vector of display type.
\code{n} or \code{prop} can be selected.}

\item{display_total}{A logical value to display total.}

\item{display_standard_histogram}{A logical value if the standard histogram
is displayed.}

\item{standard_histogram_label}{A character value of label for
the standard histogram.}

\item{display_stacked_histogram}{A logical value if the stacked histogram
is displayed.}

\item{stacked_histogram_label}{A character value of label for
the stacked histogram.}

\item{display_horizontal_histogram}{A logical value if the horizontal histogram
is displayed.}

\item{horizontal_histogram_label}{A character value of label for}

\item{plot_group_label}{A label for grouping.}

\item{plot_category_label}{A label for category.}

\item{hover_summary_var}{A character vector of statistics to be displayed
on hover label of bar.}

\item{width}{Width of the plot.}

\item{height}{Height of the plot.}
}
\value{
Interactive plot for exposure duration.
}
\description{
Create an interactive plot for exposure duration
}
\examples{
# Only run this example in interactive R sessions
if (interactive()) {
  meta <- metalite::meta_adam(
    population = metalite_sl_adexsum,
    observation = metalite_sl_adexsum
  ) |>
    metalite::define_plan(metalite::plan(
      analysis = "exp_dur", population = "apat",
      observation = "apat", parameter = "expdur"
    )) |>
    metalite::define_population(
      name = "apat", group = "TRTA", subset = APERIOD == 1 & AVAL > 0
    ) |>
    metalite::define_parameter(
      name = "expdur", subset = PARAMCD == "TRTDURD", var = "AVAL",
      label = "Exposure Duration (Days)", vargroup = "EXDURGR"
    ) |>
    metalite::define_analysis(
      name = "exp_dur", title = "Summary of Exposure Duration",
      label = "exposure duration table"
    ) |>
    metalite::meta_build()

  outdata <- meta |>
    prepare_exp_duration() |>
    extend_exp_duration(
      duration_category_list = list(c(1, NA), c(7, NA), c(28, NA), c(12 * 7, NA), c(24 * 7, NA)),
      duration_category_labels = c(">=1 day", ">=7 days", ">=28 days", ">=12 weeks", ">=24 weeks")
    )

  outdata |> plotly_exp_duration()
}
}
