R doesn't let me execute a stat_summary function when drawing a bar graph.
I load a csv file into a dataframe:
df <- read.csv("spelling.csv")
The commands for the graph:
bar <- ggplot(df, aes(Group, Errors))
bar + stat_summary(fun = mean, geom = "bar", fill = "White", colour = "Black")
The stat_summary causes the problem. R Studio throws the following error message:
Warning message:
Computation failed in stat_summary(): Can't convert a double vector to function
Why do I get this error message? How can I fix this?
My best guess is that you have 'poisoned' your environment by saving some numbers into a variable named mean, and stat_summary is getting this rather than the base::mean function.
what do you see when you type mean into the console ?
Thank you so much, nirgrahamuk! You gave the right hint!
I removed the variables created in previous assignments from the environment. After that, the stat_summary function could be executed without problem. In order to remove the variables, I used: