Error in get(as.character(FUN), mode = “function”, envir = envir)

亡梦爱人 提交于 2019-11-29 03:52:38
Anirudh Ashok

I had exactly the same error message when I named a variable with the same name of an existing function in R. I've found this tip here: http://notepad.patheticcockroach.com/2565/a-bad-idea-in-r-using-variables-with-the-same-name-as-existing-functions/ Hope it helps you too. – FraNut Oct 12 at 11:26

He's right refrain from using variables that might be function names too.

e.g

z1<-aggregate(steps ~ interval, data_df, mean)
mean<-mean(z[,2],na.rm = TRUE)

mean is a variable and a function name passed as an argument to the aggregate function causing a conflict

Nyine

Many times that error will appear when you previously created an object called "mean" in the R environment. This creates a conflict when calling the function "mean". To stop this error use:

rm(mean)

This removes the object "mean" from the environment and allows R to call the function "mean".

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!