Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
df 是工作区中的数据框。我有一个称为表单元数据的列表:
metadata$dfname = "df" metadata$otherinfo = otherinfo
我想对表单的 df 进行操作:
rm(df)
我可以将数据集名称获取为:
eval(parse(text="metadata$dfname"))
返回:
"df"
如何对 df 进行操作?我在 eval 和 parse 语句中尝试了多种使用“rm()”的方法,但它不起作用。任何想法将不胜感激。
类似ls和的函数rm有一个list参数,可让您将对象的名称指定为字符串。所以在这种情况下,你想要rm(list=metadata$dfname).
ls
rm
list
rm(list=metadata$dfname)