MyNixOS website logo
Description

Wrapper Functions for the 'glue' Library.

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>.

glueDo

The glueDo package provides a set of wrapper functions around the glue package, allowing you to seamlessly pass glue strings to a variety of functions and execute them. These functions simplify the use of dynamic strings in various common tasks.

Installation

You can install the development version of glueDo from GitHub using the remotes package:

# If you don't have the remotes package installed, install it first
install.packages("remotes")

# Install glueDo from GitHub
remotes::install_github("hswerdfe/glueDo")
Alternatively, you can use the devtools package:# If you don't have the devtools package installed, install it first
install.packages("devtools")

# Install glueDo from GitHub
devtools::install_github("hswerdfe/glueDo")

Functions

The main functions provided by this package are:

glue_do The glue_do function evaluates a glue string and passes the result to a specified function.

glue_do("The answer is {42}", .func = print)

glue_stop The glue_stop function evaluates a glue string and uses it to throw an error.

glue_stop("An error occurred: {error_message}", error_message = "Something went wrong")

glue_print The glue_print function evaluates a glue string and prints the result.

glue_print("The quick brown fox {action}", action = "jumps over the lazy dog")

glue_message The glue_message function evaluates a glue string and sends it as a message.

glue_message("Welcome to {place}", place = "New York")

glue_warning The glue_warning function evaluates a glue string and sends it as a warning.

glue_warning("This is a warning about {issue}", issue = "disk space")

Each of these functions takes a glue string and executes it using the specified function (print, message, warning, etc.).UsageHere’s an example of how to use the glue_message function:library(glueDo)

License

This package is licensed under the MIT License. See the LICENSE file for more details.

Metadata

Version

0.1.0

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-windows
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows