R/bar.group.R

Defines functions bar.group

Documented in bar.group

bar.group <-
function(x,horiz=FALSE, decreasing=TRUE,...) {
x <- x[order(x[, 1], decreasing = decreasing),]
y<-x[,1]
names(y)<-rownames(x)
nivel<-x[,2]
n<-length(y)
index<-barplot(y,horiz=horiz, ...)
tope<-max(y)/10
for ( i in 1:n) {
if (horiz) text(y[i]+tope,index[i],nivel[i])
else {
if (y[i]<0) text(index[i],abs(tope),nivel[i])
else text(index[i],y[i]+tope,nivel[i])
}
}
invisible(list(x=index,height=y))
}

Try the agricolae package in your browser

Any scripts or data that you put into this service are public.

agricolae documentation built on Oct. 23, 2023, 1:06 a.m.