how to get value when a variable name is passed as a string

后端 未结 4 1327
别跟我提以往
别跟我提以往 2020-12-02 16:02

i write this code in R

paste(\"a\",\"b\",\"c\") 

which returns the value \"abc\"

Variable abc has a value

4条回答
  •  -上瘾入骨i
    2020-12-02 16:32

    paste("a","b","c") gives "a b c" not "abc"

    Anyway, I think you are looking for get():

    > abc <- 5
    > get("abc")
    [1] 5
    

提交回复
热议问题