50% off: Unlimited data and AI learning.
State of Data and AI Literacy Report 2025

zfit (version 0.4.0)

curly_arg: Process curly parameters

Description

Curly parameters are processed using NSE, unless they are encapsulated in curlies {}, which optionally triggers standard evaluation. This function is only intended to be used inside another function, and it is used in a very similar way to match.arg(). The examples are very useful ...

Usage

curly_arg(param)

Arguments

param

The parameter to process as a curly param.

Examples

Run this code
# Not run automatically because curly_arg() is private
if (FALSE) {
  # Usage of curly_arg() compared with match.arg()
  curly_demo <- function(x, y = c("yes", "no")) {
    x <- zfit:::curly_arg(x)
    y <- match.arg(y)
    x
  }

  myparam  <- "a string"
  myvector <- c("string 1", "string 2")

  curly_demo(a_symbol)       # NSE ON
  curly_demo("a string")     # NSE disabled with "" for constant strins
  curly_demo({"curly-wrap"}) # NSE disabled with {}
  curly_demo(c("a","b"))     # NSE ON, usually not wanted, quoting preferred
  curly_demo({c("a","b")})   # NSE disabled with {}, allowing vectors
  curly_demo(myparam)        # NSE ON, even if a value exists for myparam
  curly_demo("myparam")      # NSE disabled, result is a string constant
  curly_demo({myparam})      # NSE disabled, value of myparam propagates
  curly_demo({myvector})     # NSE disabled, value of myvector propagates
}

Run the code above in your browser using DataLab