Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

assign-constant

Create a constant (locked) binding.


Description

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

Usage

x %<c-% value

Arguments

x

unquoted expression naming variable to create

value

constant value

Examples

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

Tools for Computing on the Language

v0.1.4
GPL-2
Authors
Hadley Wickham [aut, cre], R Core team [ctb] (Some code extracted from base R)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.