Reputation: 39
Let's say I have a variable "chicago" which is currently 30.
chicago <- 30
I also have a text string variable "a" which is currently "chicago".
a <- "chicago"
How can I store another number (say 40) to "a" and make it save to chicago.
Upvotes: 0
Views: 32
Reputation: 2188
You're looking for the assign
function:
chicago = 30
a = "chicago"
assign(a, 40)
chicago
# 40
Upvotes: 1