init_if_absent: Initializes an object with a value only if an object with the...

Description Usage Arguments Examples

View source: R/init_if_absent.R

Description

Get a name (as "character"), checks if there is an object with that name exists, if it does it leaves the object untouched. If it does not exists, sets it to "value". Returns messages indicating what happened. If an object is given it checks the value inside the object and if it is "character" the function uses this string to name the object.

Usage

1

Arguments

name

name to be used on object assignment.

value

value to give pass to the object.

Examples

1
2
3
4
5
6
7
init_if_absent("y", 1:10)
init_if_absent("y", 11:20) # repeating does not change its value

name <- "var1"
init_if_absent(name, 200:100)
var1
name

mtcruz/mtcruzr documentation built on Dec. 26, 2019, 11:04 p.m.