piravi
piravi

Reputation: 209

Name a variabile with the value of another variable

Suppose I have a variable:

x <- "Cat"

This variable x must define the name of another variable"

[x] <- c(1,2,3)

that is, in this example:

Cat <- c(1,2,3)

Any tip?

Upvotes: 1

Views: 39

Answers (1)

Wencheng Lau-Medrano
Wencheng Lau-Medrano

Reputation: 753

Here.

x <- "cat"

assign(x = x, value = 1:3)

Upvotes: 2

Related Questions