I have data with only two columns:
Name Id
Joy 5
Alo 6
Aho 4
Joy 3
Alo 2
Aho 1
If I want to plot a line chart with error bar grouping them with the names:
I use this:
data_summary <- function(data, varname, groupnames){
require(plyr)
summary_func <- function(x, col){
c(mean = mean(x[[col]], na.rm=TRUE),
#sd = sd(x[[col]], na.rm=TRUE))
}
data_sum<-ddply(data, groupnames, .fun=summary_func,
varname)
data_sum <- rename(data_sum, c("mean" = varname))
return(data_sum)
}
but it gives me this error
Error: All arguments must be named Call
rlang::last_error()
to see a backtrace Called from: abort("All arguments must be named")
df2 <- data_summary(df, varname="Id",
groupnames=c("Name")
ggplot(df2, aes(x=Name, y=Id, group=keyword)) +
geom_line()+
geom_pointrange(aes(ymin=Id-sd, ymax=Ido+sd))
please if anyone could help to draw the error bar for this data