If I have a variable
x <- "foo"
and another variable
y <- 1:5
is there a way I can rename y to foo while keeping it equal to 1:5?
If I have a variable
x <- "foo"
and another variable
y <- 1:5
is there a way I can rename y to foo while keeping it equal to 1:5?
You could use comment() so that foo was an attribute of y. For example, try:
x <- "foo"
y <- 1:5
comment(y) <- x
str(y)
attr(y, "comment")