By accident I created a variable called ls which I have spotted using ls(). So there exist a function ls() and a variable with the identical name. I do not know what kind of variable it is and don’t know the content because all attempts failed to access the variable.
ls
returned the body of the ls() function.
get("ls")
returned Error in get(ls) : invalid first argument
get("ls", mode="numeric")
object ‘ls’ of mode ‘numeric’ was not found
get("ls", mode=!"function")
is not a valid argument.
So how can I access the variable? I tried also class(ls) and str(ls) but all is referring to ls as a function.
I can’t find the right question to this. But I am sure I have read about that before. So I am sorry if that is a duplicate post. Help and a link would be appreciated.
EDIT: the output of dput(ls()[grep("^ls$", ls())]) is:
"ls"
EDIT: the output of dput(ls()) is:
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")
One possibility is that you have copied the function
ls(), i.e.This reproduces your “problems” So
returns a function. You get the same error messages:
and the
dputgives the same result: