[R] Help please

Areti Panopoulou @ret|p@nopou|ou @end|ng |rom gm@||@com
Wed Mar 10 19:29:11 CET 2021


I am trying to make a stacked barplot with different behaviours
("inactive", "active", "foraging" etc) on different substrates ("tree",
"ground" etc). I have found this function:

# Stacked Bar Plot with Colors and Legend
counts <- table(mtcars$vs, mtcars$gear)
barplot(counts, main="Car Distribution by Gears and VS",
  xlab="Number of Gears", col=c("darkblue","red"),
  legend = rownames(counts))

But don't know how to apply it. Can anybody help me apply the function to
work with my variables ( I can send more information if necessary, or make
any clarifications).

This is a great help, thanks a lot.

	[[alternative HTML version deleted]]

More information about the R-help mailing list