【问题标题】:how do I get the variable name of a list如何获取列表的变量名
【发布时间】:2016-03-04 19:24:12
【问题描述】:

我正在尝试读取列表类型对象的名称。即

myList <- list("foo","foo1")

我通常读取对象名称的方式是:

deparse(substitute(myList))

但是如果是这个列表,它会返回:

"列表(\"foo\", \"foo1\")"

我想要的结果是“myList”。有人可以帮忙吗?

【问题讨论】:

  • as.character(substitute(.. 有什么问题
  • ups 对不起,实际上给了我想要的输出

标签: r


【解决方案1】:

我读取函数的方式实际上返回了我首先提到的不太可能的预期结果。

 as.character(substitute(myList))

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-06-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-12-31
    • 1970-01-01
    相关资源
    最近更新 更多