assign-constant: Create a constant (locked) binding.

Description Usage Arguments Examples

Description

Infix wrapper for assign + lockBinding that creates a constant: a binding whose value can not be changed.

Usage

1
x %<c-% value

Arguments

x

unquoted expression naming variable to create

value

constant value

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
x %<c-% 10
#' Generates an error:
## Not run: x <- 20

# Note that because of R's operator precedence rules, you
# need to wrap compound RHS expressions in ()
y %<c-% 1 + 2
y
z %<c-% (1 + 2)
z

pryr documentation built on May 2, 2019, 9:58 a.m.