Type: | Package |
Title: | Wrapper Functions for the 'glue' Library |
Version: | 0.1.0 |
Description: | Provides convenient wrapper functions around the 'glue' library for common string interpolation tasks. The package simplifies the process of combining 'glue' string templating with common R functions like message(), warning(), stop(), print(), cat(), and file writing operations. Instead of manually calling glue() and then passing the result to these functions, 'glueDo' provides direct wrapper functions that handle both steps in a single call. This is particularly useful for logging, error handling, and formatted output in R scripts and packages. The main reference for the underlying 'glue' package is Hester and Bryan (2022) https://CRAN.R-project.org/package=glue. |
License: | MIT + file LICENSE |
Encoding: | UTF-8 |
RoxygenNote: | 7.3.2 |
Imports: | glue (≥ 1.8.0) |
Depends: | R (≥ 4.3.0) |
NeedsCompilation: | no |
Packaged: | 2025-05-28 19:59:12 UTC; SwerdfeH |
Author: | Howard Swerdfeger [aut, cre] |
Maintainer: | Howard Swerdfeger <hswerdfe@gmail.com> |
Repository: | CRAN |
Date/Publication: | 2025-05-30 09:40:09 UTC |
Glue Wrapper Functions
Description
These functions are used to pass a glue string to a function and execute it.
Usage
glue_do(.x, ..., .envir = parent.frame(), .func)
glue_func(.x, .func, ..., .envir = parent.frame())
glue_stop(.x, ..., .envir = parent.frame(), .func = stop)
glue_print(.x, ..., .envir = parent.frame(), .func = print)
glue_message(.x, ..., .envir = parent.frame(), .func = message)
glue_warning(.x, ..., .envir = parent.frame(), .func = warning)
glue_cat(.x, ..., .envir = parent.frame(), .func = cat)
glue_return(.x, ..., .envir = parent.frame(), .func = identity)
glue_write(.x, file, ..., .envir = parent.frame(), .func = writeLines)
Arguments
.x |
The glue string containing expressions to be evaluated. |
... |
Additional arguments passed to 'glue'. |
.envir |
The environment where the expressions in the glue string are evaluated. Defaults to 'parent.frame()'. |
.func |
A function to execute with the result of the evaluated glue string. |
file |
file file |
Value
Returns the result of executing '.func' with the evaluated glue string.
Functions
-
glue_func()
: Executes a custom function with the evaluated glue string. -
glue_stop()
: Executes the 'stop' function with the evaluated glue string. -
glue_print()
: Executes the 'print' function with the evaluated glue string. -
glue_message()
: Executes the 'message' function with the evaluated glue string. -
glue_warning()
: Executes the 'warning' function with the evaluated glue string. -
glue_cat()
: Executes the 'cat' function with the evaluated glue string. -
glue_return()
: Evaluates the glue string and returns the result. -
glue_write()
: Initializes a file connection and writes the evaluated glue string to it.
Examples
world <- 'mars'
glue_message('HELLO {world}!')