Dear All, Is there some way of drawing a boxplot, with R, when one does not have the original continuous data, but only the data grouped in classes? The function boxplot() can only deal with original data. Thanks in advance, Paul
Paul Smith <phhs80 at gmail.com> wrote> >Is there some way of drawing a boxplot, with R, when one does not have >the original continuous data, but only the data grouped in classes? >The function boxplot() can only deal with original data.It's not clear how the data are, now. What are the classes? Are they numbers? Let's make something up. Is this what you have and want? y <- c(rep("0-10", 5), rep("11-20", 10), rep("21-30", 15)) y <- as.ordered(y) y <- as.numeric(y) y[y == 1] <- 5 y[y == 2] <- 15.5 y[y == 3] <- 25.5 boxplot(y) ? Peter Peter L. Flom, PhD Statistical Consultant Website: www DOT peterflomconsulting DOT com Writing; http://www.associatedcontent.com/user/582880/peter_flom.html Twitter: @peterflom
On Thu, Oct 22, 2009 at 04:36:22PM +0100, Paul Smith wrote:> Is there some way of drawing a boxplot, with R, when one does not have > the original continuous data, but only the data grouped in classes? > The function boxplot() can only deal with original data.Do you mean a numeric vector grouped by a factor? If you have a numeric vector x and a categorical variable f, then: boxplot(x ~ f)
On Thu, Oct 22, 2009 at 5:31 PM, Jakson A. Aquino <jaksonaquino at gmail.com> wrote:>> Is there some way of drawing a boxplot, with R, when one does not have >> the original continuous data, but only the data grouped in classes? >> The function boxplot() can only deal with original data. > > Do you mean a numeric vector grouped by a factor? If you have a > numeric vector x and a categorical variable f, then: > > boxplot(x ~ f)No, Jakson, I mean something like the following: [0,1] --> 5% ]1,3] --> 25% ]3,4] --> 10% ]4,7] --> 20% ]7,11] --> 40% Paul