Skip to content

ploting the two sets of data side by side

4 messages · Subhabrata, Jacques VESLOT, Gabor Grothendieck +1 more

#
try :

barplot(do.call("rbind",lapply(list(x,y), function(x) table(cut(x, 
breaks =c(0,5,10,20,25,30))))),beside=T)

Subhabrata a ??crit :
#
Or building on that solution but eliminating the do.call and lapply:

f <- function(x) table(cut(x, breaks = seq(0, 30, 5)))
barplot(rbind(f(x), f(y)), beside = TRUE)
On 12/7/05, Jacques VESLOT <jacques.veslot at cirad.fr> wrote:
#
As usual, Gabor provides an elegant solution. But I hope that, in
this case, the OP provided a toy example. Otherwise, I don't see
the point of applying cut() to a vector of length 7. Why not just
use stripchart()?

Peter Ehlers
Gabor Grothendieck wrote: