Gets a unique non-existing temporary variable name
Gets a unique non-existing temporary variable name and optionally assigns it an initial value.
tempvar(prefix="var", value, envir=parent.frame(), inherits=FALSE)
prefix |
A |
value |
(optional) If given, a variable with the temporary name is assigned this value. |
envir |
An |
inherits |
A |
Returns a character
string.
Henrik Bengtsson
# Get a temporary variable name <- tempvar() print(name) # Get and assign a temporary variable name <- tempvar(value=base::letters) print(name) str(get(name)) # Get a temporary variable with custom prefix name <- tempvar(prefix=".hidden") print(name)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.