diff --git a/R/teal_slice.R b/R/teal_slice.R index 08201fc4e..6b843164c 100644 --- a/R/teal_slice.R +++ b/R/teal_slice.R @@ -2,6 +2,35 @@ #' #' Create a `teal_slice` object that holds complete information on filtering one variable. #' +# Custom @usage section is needed to that utility functions are listed in the usage and they do not have index entries. +#' @usage +#' teal_slice( +#' dataname, +#' varname, +#' id, +#' expr, +#' choices = NULL, +#' selected = NULL, +#' keep_na = NULL, +#' keep_inf = NULL, +#' fixed = FALSE, +#' anchored = FALSE, +#' multiple = TRUE, +#' title = NULL, +#' ... +#' ) +#' +#' is.teal_slice(x) +#' +#' as.teal_slice(x) +#' +#' \method{as.list}{teal_slice}(x, ...) +#' +#' \method{format}{teal_slice}(x, show_all = FALSE, trim_lines = TRUE, ...) +#' +#' \method{print}{teal_slice}(x, ...) +#' +#' @details #' `teal_slice` object fully describes filter state and can be used to create, #' modify, and delete a filter state. A `teal_slice` contains a number of common fields #' (all named arguments of `teal_slice`), some of which are mandatory, but only @@ -110,8 +139,10 @@ #' #' @seealso [`teal_slices`] #' +#' @aliases is.teal_slice as.teal_slice as.list.teal_slice format.teal_slice print.teal_slice +#' #' @export -teal_slice <- function(dataname, +teal_slice <- function(dataname, # When editing function parameters, please remember to update @usage section. varname, id, expr, @@ -172,7 +203,6 @@ teal_slice <- function(dataname, ans } -#' @rdname teal_slice #' @export #' @keywords internal #' @@ -180,7 +210,6 @@ is.teal_slice <- function(x) { # nolint inherits(x, "teal_slice") } -#' @rdname teal_slice #' @export #' @keywords internal #' @@ -189,7 +218,6 @@ as.teal_slice <- function(x) { # nolint do.call(teal_slice, x) } -#' @rdname teal_slice #' @export #' @keywords internal #' @@ -208,8 +236,6 @@ as.list.teal_slice <- function(x, ...) { x[c(formal_args, extra_args)] } - -#' @rdname teal_slice #' @export #' @keywords internal #' @@ -223,7 +249,6 @@ format.teal_slice <- function(x, show_all = FALSE, trim_lines = TRUE, ...) { jsonify(x_list, trim_lines) } -#' @rdname teal_slice #' @export #' @keywords internal #' @@ -231,7 +256,6 @@ print.teal_slice <- function(x, ...) { cat(format(x, ...)) } - # format utils ----- #' Convert a list to a justified `JSON` string diff --git a/R/teal_slices.R b/R/teal_slices.R index 7fb9161c0..8a4b53b92 100644 --- a/R/teal_slices.R +++ b/R/teal_slices.R @@ -2,6 +2,31 @@ #' #' Create `teal_slices` object to package multiple filters and additional settings. #' +# Custom @usage section is needed to that utility functions are listed in the usage and they do not have index entries. +#' @usage +#' teal_slices( +#' ..., +#' exclude_varnames = NULL, +#' include_varnames = NULL, +#' count_type = NULL, +#' allow_add = TRUE +#' ) +#' +#' is.teal_slices(x) +#' +#' as.teal_slices(x) +#' +#' \method{as.list}{teal_slices}(x, recursive = FALSE, ...) +#' +#' \method{[}{teal_slices}(x, i) +#' +#' \method{c}{teal_slices}(...) +#' +#' \method{format}{teal_slices}(x, show_all = FALSE, trim_lines = TRUE, ...) +#' +#' \method{print}{teal_slices}(x, ...) +#' +#' @details #' `teal_slices()` collates multiple `teal_slice` objects into a `teal_slices` object, #' a complete filter specification. This is used by all classes above `FilterState` #' as well as `filter_panel_api` wrapper functions. @@ -27,10 +52,12 @@ #' - `"all"` to have counts of single `FilterState` to show number of observation in filtered #' and unfiltered dataset. Note, that issues were reported when using this option with `MultiAssayExperiment`. #' Please make sure that adding new filters doesn't fail on target platform before deploying for production. -#' @param allow_add (`logical(1)`) logical flag specifying whether the user will be able to add new filters -#' @param x object to test for `teal_slices`, object to convert to `teal_slices` or a `teal_slices` object -#' @param i (`character` or `numeric` or `logical`) indicating which elements to extract -#' @param recursive (`logical(1)`) flag specifying whether to also convert to list the elements of this `teal_slices` +#' @param allow_add (`logical(1)`) logical flag specifying whether the user will be able to add new filters. +#' @param x object to test for `teal_slices`, object to convert to `teal_slices` or a `teal_slices` object. +#' @param i (`character` or `numeric` or `logical`) indicating which elements to extract. +#' @param recursive (`logical(1)`) flag specifying whether to also convert to list the elements of this `teal_slices`. +#' @param show_all (`logical(1)`) whether to display non-null elements of constituent `teal_slice` objects. +#' @param trim_lines (`logical(1)`) whether to trim lines. #' #' @return #' `teal_slices`, which is an unnamed list of `teal_slice` objects. @@ -86,9 +113,12 @@ #' - [`teal_slice`] for creating constituent elements of `teal_slices` #' - [`teal::slices_store`] for robust utilities for saving and loading `teal_slices` in `JSON` format #' +#' @aliases is.teal_slices as.teal_slices as.list.teal_slices format.teal_slices print.teal_slices c.teal_slices +#' [.teal_slices +#' #' @export #' -teal_slices <- function(..., +teal_slices <- function(..., # When editing function parameters, please remember to update @usage section. exclude_varnames = NULL, include_varnames = NULL, count_type = NULL, @@ -126,8 +156,6 @@ teal_slices <- function(..., ) } - -#' @rdname teal_slices #' @export #' @keywords internal #' @@ -135,8 +163,6 @@ is.teal_slices <- function(x) { # nolint inherits(x, "teal_slices") } - -#' @rdname teal_slices #' @export #' @keywords internal #' @@ -149,8 +175,6 @@ as.teal_slices <- function(x) { # nolint do.call(teal_slices, c(ans, attrs)) } - -#' @rdname teal_slices #' @export #' @keywords internal #' @@ -160,8 +184,6 @@ as.list.teal_slices <- function(x, recursive = FALSE, ...) { # nolint ans } - -#' @rdname teal_slices #' @export #' @keywords internal #' @@ -184,8 +206,6 @@ as.list.teal_slices <- function(x, recursive = FALSE, ...) { # nolint y } - -#' @rdname teal_slices #' @export #' @keywords internal #' @@ -206,10 +226,6 @@ c.teal_slices <- function(...) { ) } - -#' @rdname teal_slices -#' @param show_all (`logical(1)`) whether to display non-null elements of constituent `teal_slice` objects -#' @param trim_lines (`logical(1)`) whether to trim lines #' @export #' @keywords internal #' @@ -228,7 +244,6 @@ format.teal_slices <- function(x, show_all = FALSE, trim_lines = TRUE, ...) { jsonify(slices_list, trim_lines) } -#' @rdname teal_slices #' @export #' @keywords internal #' diff --git a/man/teal_slice.Rd b/man/teal_slice.Rd index 937bac65b..f87dc2210 100644 --- a/man/teal_slice.Rd +++ b/man/teal_slice.Rd @@ -171,4 +171,3 @@ print(x1, show_all = TRUE, trim_lines = FALSE) \seealso{ \code{\link{teal_slices}} } -\keyword{internal} diff --git a/man/teal_slices.Rd b/man/teal_slices.Rd index 0e931d40b..062e50191 100644 --- a/man/teal_slices.Rd +++ b/man/teal_slices.Rd @@ -5,10 +5,10 @@ \alias{is.teal_slices} \alias{as.teal_slices} \alias{as.list.teal_slices} -\alias{[.teal_slices} -\alias{c.teal_slices} \alias{format.teal_slices} \alias{print.teal_slices} +\alias{c.teal_slices} +\alias{[.teal_slices} \title{Complete filter specification} \usage{ teal_slices( @@ -54,17 +54,17 @@ and unfiltered dataset. Note, that issues were reported when using this option w Please make sure that adding new filters doesn't fail on target platform before deploying for production. }} -\item{allow_add}{(\code{logical(1)}) logical flag specifying whether the user will be able to add new filters} +\item{allow_add}{(\code{logical(1)}) logical flag specifying whether the user will be able to add new filters.} -\item{x}{object to test for \code{teal_slices}, object to convert to \code{teal_slices} or a \code{teal_slices} object} +\item{x}{object to test for \code{teal_slices}, object to convert to \code{teal_slices} or a \code{teal_slices} object.} -\item{recursive}{(\code{logical(1)}) flag specifying whether to also convert to list the elements of this \code{teal_slices}} +\item{i}{(\code{character} or \code{numeric} or \code{logical}) indicating which elements to extract.} -\item{i}{(\code{character} or \code{numeric} or \code{logical}) indicating which elements to extract} +\item{recursive}{(\code{logical(1)}) flag specifying whether to also convert to list the elements of this \code{teal_slices}.} -\item{show_all}{(\code{logical(1)}) whether to display non-null elements of constituent \code{teal_slice} objects} +\item{show_all}{(\code{logical(1)}) whether to display non-null elements of constituent \code{teal_slice} objects.} -\item{trim_lines}{(\code{logical(1)}) whether to trim lines} +\item{trim_lines}{(\code{logical(1)}) whether to trim lines.} } \value{ \code{teal_slices}, which is an unnamed list of \code{teal_slice} objects. @@ -137,4 +137,3 @@ print(all_filters, trim_lines = FALSE) \item \code{\link[teal:slices_store]{teal::slices_store}} for robust utilities for saving and loading \code{teal_slices} in \code{JSON} format } } -\keyword{internal}