get_obj: Gets copies of objects from parent environments, or returns...

View source: R/get_obj.R

get_objR Documentation

Gets copies of objects from parent environments, or returns alternative if not found

Description

Gets copies of objects from parent environments, or returns alternative if not found

Usage

get_obj(name, frame = parent.frame(), alt = NULL)

Arguments

name

text string of an object to find

alt

an alternative to return if the object is not found

Details

this is designed to use within functions in the library to access global objects, but provide a route to avoid hard-coding specific variable names in. It is not exported.

Value

either a copy of the object name or an alternative if it does not exist

Examples

library(cctu)
rm(PATH)
cctu:::get_obj("PATH")
cctu:::get_obj("PATH", alt = getwd())
PATH <- "C:/MyFile"
cctu:::get_obj("PATH")
cctu:::get_obj("PATH", alt = getwd())

shug0131/cctu documentation built on Feb. 15, 2025, 3:27 p.m.