Home > OS >  Name a variabile with the value of another variable
Name a variabile with the value of another variable

Time:07-21

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?

CodePudding user response:

Here.

x <- "cat"

assign(x = x, value = 1:3)
  •  Tags:  
  • r
  • Related