Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

335 bring teal_slice and teal_slices to package INDEX #565

Closed
wants to merge 11 commits into from
37 changes: 30 additions & 7 deletions R/teal_slice.R
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,36 @@
#'
#' @seealso [`teal_slices`]
#'
#' @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)
#'
#' # S3 method for class 'teal_slice'
#' as.list.teal_slice(x, ...)
#'
#' # S3 method for class 'teal_slice'
#' format.teal_slice(show_all = FALSE, trim_lines = TRUE, ...)
#'
#' # S3 method for class 'teal_slice'
#' print.teal_slice(x, ...)
#'
#' @export
teal_slice <- function(dataname,
varname,
Expand Down Expand Up @@ -172,15 +202,13 @@ teal_slice <- function(dataname,
ans
}

#' @rdname teal_slice
#' @export
#' @keywords internal
#'
is.teal_slice <- function(x) { # nolint
inherits(x, "teal_slice")
}

#' @rdname teal_slice
#' @export
#' @keywords internal
#'
Expand All @@ -189,7 +217,6 @@ as.teal_slice <- function(x) { # nolint
do.call(teal_slice, x)
}

#' @rdname teal_slice
#' @export
#' @keywords internal
#'
Expand All @@ -208,8 +235,6 @@ as.list.teal_slice <- function(x, ...) {
x[c(formal_args, extra_args)]
}


#' @rdname teal_slice
#' @export
#' @keywords internal
#'
Expand All @@ -223,15 +248,13 @@ format.teal_slice <- function(x, show_all = FALSE, trim_lines = TRUE, ...) {
jsonify(x_list, trim_lines)
}

#' @rdname teal_slice
#' @export
#' @keywords internal
#'
print.teal_slice <- function(x, ...) {
cat(format(x, ...))
}


# format utils -----

#' Convert a list to a justified `JSON` string
Expand Down
15 changes: 6 additions & 9 deletions man/teal_slice.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading