The function creates a barplot of numeric vector by one or two factor.
barplotgr(
yvar,
factors,
data = data,
percentage = FALSE,
errbar = !percentage,
half.errbar = TRUE,
conf.level = 0.95,
xlab = NULL,
ylab = NULL,
main = NULL,
names.arg = NULL,
bar.col = "black",
whisker = 0.015,
args.errbar = NULL,
legend = TRUE,
legend.text = NULL,
args.legend = NULL,
legend.border = FALSE,
box = TRUE,
args.yaxis = NULL,
mar = c(5, 4, 3, 2),
...
)The function returns the above described graph.
The column having the variable to represent the height of the bars.
A vector having the columns with the factors to be used in the resulting plot. Notice that the last listed factor, will be used in X-axis plot.
A data frame having the above described columns.
Logical value, set to FALSE.
Please set this option to FALSE.
Optional, default set to TRUE.
Optional, a numeric value for the confidence interval, the default is 0.95.
Optional, as in the generic barplot function.
Optional, as in the generic barplot function.
Optional, as in the generic barplot function.
Optional, as in the generic barplot function.
Optional, as in the generic barplot function.
Optional, A numeric value, the default is 0.015.
Optional, as in the generic barplot function.
Optional, as in the generic barplot function.
Optional, as in the generic barplot function.
Optional, as in the generic barplot function.
Optional, as in the generic barplot function.
Optional, as in the generic barplot function.
Optional, as in the generic barplot function.
Optional, as in the generic barplot function.
list of columns to sort on
Christian Salas-Eljatib
The present function was modified from a similar one available at https://github.com/mrxiaohe/R_Functions/blob/master/functions/bar
data(standtabRauli2)
df <- standtabRauli2
head(df)
barplotgr(yvar = nha.cd, factors = c(bosque.id,cd), data = df,
errbar = FALSE, ylim=c(0, 640))
Run the code above in your browser using DataLab