Skip to content

Commit

Permalink
document
Browse files Browse the repository at this point in the history
  • Loading branch information
teunbrand committed Oct 8, 2024
1 parent f2cd0e7 commit 2f652ea
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 2 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ Config/testthat/edition: 3
Encoding: UTF-8
LazyLoad: yes
Roxygen: list(markdown = TRUE, r6 = FALSE)
RoxygenNote: 7.2.3
RoxygenNote: 7.3.2
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export(col_shift)
export(colour_ramp)
export(comma)
export(comma_format)
export(compose_label)
export(compose_trans)
export(cscale)
export(cut_long_scale)
Expand Down
27 changes: 26 additions & 1 deletion R/label-compose.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,29 @@

#' Compose two or more label formatters together
#'
#' This labeller provides a general mechanism for composing two or more
#' labellers together.
#'
#' @param ... One or more labelling functions. These will be applied to breaks
#' consecutively.
#' [Lambda syntax][rlang::as_function] is allowed.
#' @param call A call to display in error messages.
#'
#' @return A labelling function that applies the provided
#' functions to breaks to return labels.
#'
#' @export
#'
#' @examples
#' demo_continuous(
#' c(-100, 100),
#' labels = compose_label(abs, number, ~paste0(.x, " foobar"), toupper)
#' )
#'
#' # Same result
#' demo_continuous(
#' c(-100, 100),
#' labels = compose_label(abs, label_number(suffix = " FOOBAR"))
#' )
compose_label <- function(..., call = caller_env()) {

label_list <- list2(...)
Expand Down
35 changes: 35 additions & 0 deletions man/compose_label.Rd

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

0 comments on commit 2f652ea

Please sign in to comment.