I am new to R, so forgive me if the question is a little silly. I am trying to write a simple while loop for a value function iteration. My function (optim.routine) uses the
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".
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