#load required libraries library(ggplot2) library(dplyr) #store the original measurements pr<-c('P0','P1','P2','P3','P4','P5','P6') t1<-c(0,49,56,52,266,225,306) t2<-c(0,50,50,51,277,NA, 326) t3<-c(0,48,53,56,273,209,316) #combine the data into one tibble dataMain<-tibble(pr,t1,t2,t3) #re-store the data in a tibble containing the average across each row, removing the NA value where needed. data<-dataMain %>% rowwise() %>% mutate(avg=mean(c(t1,t2,t3), na.rm=T)) #initialize the bar chart with ggplot2 bar<-ggplot(data, aes(x=pr, y=avg)) + geom_bar(stat="identity") #draw the plot bar