Probably this question is already answered but I'm not sure if it was exactly the same kind of answer I want. I search here and in other sites but neither as useful to me.
I'd like to understand how to create a variable with a reference to another in R.
Like:
Imagine I have this:
a <- c(1,2,3,4,5)
b <- c("a","b","c","d")
Now, I know I may do this:
c <- list(
var.a = list(
description = "this is var.a",
data = a ),
var.b = list(
description = "this is var.b",
data = b ) )
The code above didn't create a reference. Because If I do:
c$data$a[2] <- 99
See what I got:
c$data$a
# 1 99 3 4 5
a
# 1 2 3 4 5
So, what I'd like to have is somehow got this behavior below:
c$data$a[2] <- 99
c$data$a
# 1 99 3 4 5
a
# 1 99 3 4 5
Maybe this is a very silly simple question but any help is appreciable.
Thanks in advance