Re: [R] ploting the two sets of data side by side

From: Gabor Grothendieck <ggrothendieck_at_gmail.com>
Date: Thu 08 Dec 2005 - 00:38:21 EST

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@cirad.fr> wrote:
> 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 :
>
> >Hello R-users,
> >
> >I am new to R-commands.
> >
> >
> >I have two sets of data:
> >
> >x <- c(7, 7 , 8, 9, 15, 17, 18)
> >y <- c(7, 8, 9, 15, 17, 19, 20, 20, 25, 23, 22)
> >
> >
> >I have used 'cut' command to seperate them as follows
> >
> >a <- cut(x, breaks =c(0,5,10,20,25,30))
> >
> >b <- cut(y, breaks =c(0,5,10,20,25,30))
> >
> >
> >
> >>table(a)
> >>
> >>
> >a
> > (0,5] (5,10] (10,20] (20,25] (25,30]
> > 0 4 3 0 0
> >
> >
> >>table(b)
> >>
> >>
> >b
> > (0,5] (5,10] (10,20] (20,25] (25,30]
> > 0 3 5 3 0
> >
> >
> >Now if I want to a single graph with both sets of data side by side for same range.
> >
> >Can some one help me regarding the above problem.
> >
> >With Regards
> >Subhabrata Pal
> >subhabratapal@sraindia.com
> > [[alternative HTML version deleted]]
> >
> >______________________________________________
> >R-help@stat.math.ethz.ch mailing list
> >https://stat.ethz.ch/mailman/listinfo/r-help
> >PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
> >
> >
> >
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Thu Dec 08 00:44:43 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:41:30 EST