偶然我创建了一个名为 ls 的变量,我使用 ls() 发现了它。所以存在一个函数 ls() 和一个同名的变量。我不知道它是什么类型的变量,也不知道内容,因为所有尝试都未能访问该变量。
ls
返回 ls() 函数的主体。
get("ls")
get(ls) 中返回错误:第一个参数无效
get("ls", mode="numeric")
找不到模式“数字”的对象“ls”
get("ls", mode=!"function")
不是一个有效的论点。那么如何访问变量呢?我也尝试了 class(ls) 和 str(ls) 但都将 ls 称为函数。
我找不到正确的问题。但我确信我以前读过这方面的内容。因此,如果这是重复的帖子,我很抱歉。帮助和链接将不胜感激。
编辑:输出dput(ls()[grep("^ls$", ls())])
是:
"ls"
编辑:输出dput(ls())
是:
c("bplo.anno", "c", "combinations.formula", "combo.form", "df", "df.group.unique", "df.test", "dir.work", "form.compl", "fun.boot.lm.stepAIC.4", "fun.boot.lm.stepAIC.5", "fun.CoerceListOfVectorToMatrix", "fun.data.preparation", "fun.dcor.DataFrame", "fun.expand.complete.interaction", "fun.g.ellipse.orig", "fun.K_fold", "fun.lappend", "fun.lm.subset", "fun.lm_AIC", "fun.lst.powerset", "fun.MaxToMinModel.adjrsq", "fun.MaxToMinModel.rsq", "fun.plot.circle", "fun.results", "fun.rs.dcor", "fun.vectorcoerce", "group", "height", "i", "j", "k", "ls", "ls.boot", "ls1", "lst.boot.result", "oldwd", "regressor.names", "response.name", "result.df", "rs.dcor", "source.filename", "tbl.bt", "tbl.nm")