Learn R Programming

agricolae (version 1.0-4)

bar.group: Plotting the multiple comparison of means

Description

It plots bars of the averages of treatments to compare. It uses the objects generated by a procedure of comparison like LSD, HSD, Kruskall, Waller-Duncan, Friedman or Durbin. It can also display the 'average' value over each bar in a bar chart.

Usage

bar.group(x, horiz = FALSE, ...)

Arguments

x
Object created by a test of comparison
horiz
Horizontal or vertical bars
...
Parameters of the function barplot()

Value

  • xData frame
  • horizLogical TRUE or FALSE
  • ...

Details

x: data frame formed by 5 columns: name of the bars, height and level of the bar.

See Also

LSD.test, HSD.test, kruskal , friedman, durbin.test, waller.test

Examples

Run this code
# Example 1
library(agricolae)
data(sweetpotato)
attach(sweetpotato)
model<-aov(yield~virus)
df<-df.residual(model)
MSerror<-deviance(model)/df
comparison<- LSD.test(yield, virus,df,MSerror,alpha=0.01,group=TRUE)
#startgraph
par(cex=1.5)
bar.group(comparison,horiz=TRUE,density=8,col="blue",border="red",xlim=c(0,50))
title(cex.main=0.8,main="Comparison between
treatment means",xlab="Yield", ylab="Virus")
#endgraph
# Example 2
library(agricolae)
x <- 1:4
y <- c(0.29, 0.44, 0.09, 0.49)
xy <- data.frame(x,y,y)
#startgraph
par(cex=1.5)
bar.group(xy,density=30,angle=90,col="brown",border=FALSE,ylim=c(0,0.6),lwd=2,las=1)
#endgraph

Run the code above in your browser using DataLab