diff --git a/DESCRIPTION b/DESCRIPTION index f91f866..fdfc051 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -21,12 +21,19 @@ Suggests: httr, knitr, shinytest, - testthat (>= 2.0) + testthat (>= 2.0), + roxytypes, + roxylint +Remotes: + openpharma/roxytypes, + openpharma/roxylint, +Config/Needs/documentation: + roxytypes, + roxylint VignetteBuilder: knitr biocViews: Encoding: UTF-8 Language: en-US LazyData: true -Roxygen: list(markdown = TRUE) RoxygenNote: 7.2.3 diff --git a/R/generate_data.R b/R/generate_data.R index 521637a..06a2ca7 100644 --- a/R/generate_data.R +++ b/R/generate_data.R @@ -5,21 +5,26 @@ #' hazard for the competing event of death, and the hazard for the "soft" competing events. #' Censoring is uniform in the given range. #' -#' @param n (`count`)\cr number of patients. -#' @param cens (`numeric`)\cr minimum and maximum censoring time. -#' @param haz_ae (`number`)\cr constant hazard for AE. -#' @param haz_death (`number`)\cr constant hazard for death. -#' @param haz_soft (`number`)\cr constant hazard for soft competing event. +#' @typed n: count +#' number of patients. +#' @typed cens: numeric +#' minimum and maximum censoring time. +#' @typed haz_ae: number +#' constant hazard for AE. +#' @typed haz_death: number +#' constant hazard for death. +#' @typed haz_soft: number +#' constant hazard for soft competing event. #' -#' @return A `data.frame` with the following columns: -#' -#' - `id`: Patient ID. -#' - `time_to_event`: Time to the first AE, death or soft competing event. -#' - `type_of_event`: 0 for censored, 1 for AE, 2 for death, 3 for soft competing event. -#' - `cens`: Censoring time. +#' @typedreturn data.frame +#' a `data.frame` with the following columns: +#' - `id`: Patient ID. +#' - `time_to_event`: Time to the first AE, death or soft competing event. +#' - `type_of_event`: 0 for censored, 1 for AE, 2 for death, 3 for soft +#' competing event. +#' - `cens`: Censoring time. #' #' @export -#' #' @examples #' set.seed(123) #' generate_data(n = 5, cens = c(2, 5), haz_ae = 2, haz_death = 3, haz_soft = 5) diff --git a/R/hello.R b/R/hello.R index 58efee5..e485612 100644 --- a/R/hello.R +++ b/R/hello.R @@ -2,11 +2,13 @@ #' #' @description Greet a person and appropriately capitalize their name. #' -#' @param name Your name (character string; e.g. "john doe"). +#' @typed name: string +#' a name, such as "john doe". #' -#' @return A character string, capitalized to title case. -#' @export +#' @typedreturn string +#' capitalized to title case. #' +#' @export #' @examples #' hello("james bond") hello <- function(name = "your name") { @@ -46,7 +48,7 @@ shiny_app <- function() { #' @description Greet a person and appropriately capitalize their name #' as a Plumber API. #' -#' @param ... Additional arguments to plumber::pr_run() +#' @param ... Additional arguments to plumber::pr_run(). #' #' @return Plumber API showcasing the personal greeting feature. #' @export diff --git a/R/inc_prop.R b/R/inc_prop.R index ba2a95d..7b4c0fe 100644 --- a/R/inc_prop.R +++ b/R/inc_prop.R @@ -1,21 +1,30 @@ #' Computing the Incidence Proportion #' -#' @param data (`data.frame`)\cr with columns including -#' - `time_to_event`: Time to the first AE, death or soft competing event. -#' - `type_of_event`: 0 for censored, 1 for AE, 2 for death, 3 for soft competing event. +#' @typed data: data.frame +#' with columns including: +#' - `time_to_event`: Time to the first AE, death or soft competing +#' event. +#' - `type_of_event`: 0 for censored, 1 for AE, 2 for death, 3 for soft +#' competing event. +#' @typed tau: numeric +#' milestone at which incidence proportion is computed. #' -#' @param tau (`numeric`)\cr milestone at which incidence proportion is computed. -#' -#' @return A `vector` with the following entries: -#' -#' - `ae_prob`: Estimated probability of AE. -#' - `ae_prob_var`: Variance of that estimate. +#' @typedreturn vector +#' with the following entries: +#' - `ae_prob`: Estimated probability of AE. +#' - `ae_prob_var`: Variance of that estimate. #' #' @export -#' #' @examples #' set.seed(123) -#' dat <- generate_data(n = 5, cens = c(2, 5), haz_ae = 2, haz_death = 3, haz_soft = 5) +#' dat <- generate_data( +#' n = 5, +#' cens = c(2, 5), +#' haz_ae = 2, +#' haz_death = 3, +#' haz_soft = 5 +#' ) +#' #' inc_prop(dat, tau = 4) #' inc_prop <- function(data, diff --git a/man/generate_data.Rd b/man/generate_data.Rd index 4094c4e..18af5d9 100644 --- a/man/generate_data.Rd +++ b/man/generate_data.Rd @@ -18,11 +18,12 @@ generate_data(n, cens, haz_ae, haz_death, haz_soft) \item{haz_soft}{(\code{number})\cr constant hazard for soft competing event.} } \value{ -A \code{data.frame} with the following columns: +(\code{data.frame})\cr a \code{data.frame} with the following columns: \itemize{ \item \code{id}: Patient ID. \item \code{time_to_event}: Time to the first AE, death or soft competing event. -\item \code{type_of_event}: 0 for censored, 1 for AE, 2 for death, 3 for soft competing event. +\item \code{type_of_event}: 0 for censored, 1 for AE, 2 for death, 3 for soft +competing event. \item \code{cens}: Censoring time. } } diff --git a/man/hello.Rd b/man/hello.Rd index e7eb880..c1e57d0 100644 --- a/man/hello.Rd +++ b/man/hello.Rd @@ -7,10 +7,10 @@ hello(name = "your name") } \arguments{ -\item{name}{Your name (character string; e.g. "john doe").} +\item{name}{(\code{string})\cr a name, such as "john doe".} } \value{ -A character string, capitalized to title case. +(\code{string})\cr capitalized to title case. } \description{ Greet a person and appropriately capitalize their name. diff --git a/man/inc_prop.Rd b/man/inc_prop.Rd index d0967d0..62d954b 100644 --- a/man/inc_prop.Rd +++ b/man/inc_prop.Rd @@ -7,16 +7,18 @@ inc_prop(data, tau) } \arguments{ -\item{data}{(\code{data.frame})\cr with columns including +\item{data}{(\code{data.frame})\cr with columns including: \itemize{ -\item \code{time_to_event}: Time to the first AE, death or soft competing event. -\item \code{type_of_event}: 0 for censored, 1 for AE, 2 for death, 3 for soft competing event. +\item \code{time_to_event}: Time to the first AE, death or soft competing +event. +\item \code{type_of_event}: 0 for censored, 1 for AE, 2 for death, 3 for soft +competing event. }} \item{tau}{(\code{numeric})\cr milestone at which incidence proportion is computed.} } \value{ -A \code{vector} with the following entries: +(\code{vector})\cr with the following entries: \itemize{ \item \code{ae_prob}: Estimated probability of AE. \item \code{ae_prob_var}: Variance of that estimate. @@ -27,7 +29,14 @@ Computing the Incidence Proportion } \examples{ set.seed(123) -dat <- generate_data(n = 5, cens = c(2, 5), haz_ae = 2, haz_death = 3, haz_soft = 5) +dat <- generate_data( + n = 5, + cens = c(2, 5), + haz_ae = 2, + haz_death = 3, + haz_soft = 5 +) + inc_prop(dat, tau = 4) } diff --git a/man/plumber_api.Rd b/man/plumber_api.Rd index 84ef92b..ab96741 100644 --- a/man/plumber_api.Rd +++ b/man/plumber_api.Rd @@ -7,7 +7,7 @@ plumber_api(...) } \arguments{ -\item{...}{Additional arguments to plumber::pr_run()} +\item{...}{Additional arguments to plumber::pr_run().} } \value{ Plumber API showcasing the personal greeting feature. diff --git a/man/roxygen/meta.R b/man/roxygen/meta.R new file mode 100644 index 0000000..133fb01 --- /dev/null +++ b/man/roxygen/meta.R @@ -0,0 +1,12 @@ +list( + markdown = TRUE, + packages = c( + "roxylint", + "roxytypes" + ), + roclets = c( + "namespace", + "rd", + "roxylint::roxylint" + ) +) diff --git a/man/roxylint/meta.R b/man/roxylint/meta.R new file mode 100644 index 0000000..6cf39e4 --- /dev/null +++ b/man/roxylint/meta.R @@ -0,0 +1,13 @@ +list( + linters = list( + typed = list( + "descriptions should start lowercase" = "^[^[:upper:]]", + roxylint::lint_full_stop, + NULL # disallow registration of package defaults + ), + param = list( + "descriptions should start lowercase" = "^[^[:upper:]]", + roxylint::lint_full_stop + ) + ) +) diff --git a/man/roxytypes/meta.R b/man/roxytypes/meta.R new file mode 100644 index 0000000..fd767f6 --- /dev/null +++ b/man/roxytypes/meta.R @@ -0,0 +1,5 @@ +list( + format = function(x, name, type, default, description, ...) { + glue::glue("(`{type}`)\\cr {description}") + } +)