getSym: Extract or Set Reference Symbol

Description Usage Arguments Value Examples

View source: R/attributes.R

Description

Functions to obtain or set the object name to which a ref or sref object points.

Usage

1
2
3
getSym(x)

setSym(x, sym)

Arguments

x

object of class "ref"

sym

symbol or character naming the object to which the reference points

Value

character of length 1

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
x <- 1:10
ref_to_x <- ref(x)
ref_env  <- getEnv(ref_to_x)
ref_sym  <- getSym(ref_to_x)

identical(ref_env, .GlobalEnv)
identical(ref_sym, "x")

y <- 500
ref_to_x <- setSym(ref_to_x, y)
!ref_to_x

refer documentation built on Nov. 8, 2021, 5:08 p.m.