David A.
2010-Sep-06 15:46 UTC
[R] boxplot knowing Q1, Q3, median, upper and lower whisker value
Dear list, I am using a external program that outputs Q1, Q3, median, upper and lower whisker values for various datasets simultaneously in a tab delimited format. After importing this text file into R, I would like to plot a boxplot using these given values and not the original series of data points, i.e. not using something like boxplot(mydata). Is there an easy way for doing this? If I am not wrong, boxplot() does not accept these values as parameters. Cheers, Dave [[alternative HTML version deleted]]
Joshua Wiley
2010-Sep-06 16:21 UTC
[R] boxplot knowing Q1, Q3, median, upper and lower whisker value
Hi Dave, You can look at the function ?bxp it might work for you. Alternately, create a meaningless boxplot object, and then just edit that data, in which case I know it will work with bxp(). # Create a boxplot, the data does not matter x <- boxplot(1:10) x # view the data for the boxplot x$stats <- c() # put the stats here, min Q1, median, Q3, max # or hinges or whatever you like x$n <- c() # the number of observations, though you do not need to change this bxp(x) # plot boxplot with updated info HTH, Josh On Mon, Sep 6, 2010 at 8:46 AM, David A. <dasolexa at hotmail.com> wrote:> > Dear list, > > I am using a external program that outputs Q1, Q3, median, upper and lower whisker values for various datasets simultaneously in a tab delimited format. After importing this text file into R, I would like to plot a boxplot using these given values and not the original series of data points, i.e. not using something like boxplot(mydata). > > Is there an easy way for doing this? If I am not wrong, boxplot() does not accept these values as parameters. > > Cheers, > > Dave > > ? ? ? ?[[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >-- Joshua Wiley Ph.D. Student, Health Psychology University of California, Los Angeles http://www.joshuawiley.com/
Brian Diggs
2010-Sep-09 19:40 UTC
[R] boxplot knowing Q1, Q3, median, upper and lower whisker value
On 9/6/2010 8:46 AM, David A. wrote:> > Dear list, > > I am using a external program that outputs Q1, Q3, median, upper and > lower whisker values for various datasets simultaneously in a tab > delimited format. After importing this text file into R, I would like > to plot a boxplot using these given values and not the original > series of data points, i.e. not using something like > boxplot(mydata). > > Is there an easy way for doing this? If I am not wrong, boxplot() > does not accept these values as parameters. > > Cheers, > > Dave [[alternative HTML version deleted]]If you use ggplot2, you can specify the aesthetics lower, upper, middle, ymin, and ymax directly to variables in geom_boxplot. Just be sure to set stat="identity" so that it does not try to summarize your data again. -- Brian Diggs Senior Research Associate, Department of Surgery Oregon Health & Science University
Peng, C
2010-Sep-10 17:46 UTC
[R] boxplot knowing Q1, Q3, median, upper and lower whisker value
x=1:16 S=summary(x) >S Min. 1st Qu. Median Mean 3rd Qu. Max. 1.00 4.75 8.50 8.50 12.25 16.00>S[-4]Min. 1st Qu. Median 3rd Qu. Max. 1.00 4.75 8.50 12.25 16.00 par(mfrow=c(1,2)) boxplot(S[-4]) # based on the summarized stats boxplot(x) # based on the raw data -- View this message in context: http://r.789695.n4.nabble.com/boxplot-knowing-Q1-Q3-median-upper-and-lower-whisker-value-tp2528571p2534818.html Sent from the R help mailing list archive at Nabble.com.
Greg Snow
2010-Sep-10 17:55 UTC
[R] boxplot knowing Q1, Q3, median, upper and lower whisker value
For base graphics the bxp function does the actual plotting given the statistics. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.snow at imail.org 801.408.8111> -----Original Message----- > From: r-help-bounces at r-project.org [mailto:r-help-bounces at r- > project.org] On Behalf Of Brian Diggs > Sent: Thursday, September 09, 2010 1:41 PM > To: David A. > Cc: R-help > Subject: Re: [R] boxplot knowing Q1, Q3, median, upper and lower > whisker value > > On 9/6/2010 8:46 AM, David A. wrote: > > > > Dear list, > > > > I am using a external program that outputs Q1, Q3, median, upper and > > lower whisker values for various datasets simultaneously in a tab > > delimited format. After importing this text file into R, I would like > > to plot a boxplot using these given values and not the original > > series of data points, i.e. not using something like > > boxplot(mydata). > > > > Is there an easy way for doing this? If I am not wrong, boxplot() > > does not accept these values as parameters. > > > > Cheers, > > > > Dave [[alternative HTML version deleted]] > > If you use ggplot2, you can specify the aesthetics lower, upper, > middle, > ymin, and ymax directly to variables in geom_boxplot. Just be sure to > set stat="identity" so that it does not try to summarize your data > again. > > -- > Brian Diggs > Senior Research Associate, Department of Surgery > Oregon Health & Science University > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting- > guide.html > and provide commented, minimal, self-contained, reproducible code.
William Dunlap
2010-Sep-10 18:00 UTC
[R] boxplot knowing Q1, Q3, median, upper and lower whisker value
is.nan(bd.coerce(as.bdVector(c(1.0, N> -----Original Message-----> From: r-help-bounces at r-project.org > [mailto:r-help-bounces at r-project.org] On Behalf Of Brian Diggs > Sent: Thursday, September 09, 2010 12:41 PM > To: David A. > Cc: R-help > Subject: Re: [R] boxplot knowing Q1, Q3, median,upper and > lower whisker value > > On 9/6/2010 8:46 AM, David A. wrote: > > > > Dear list, > > > > I am using a external program that outputs Q1, Q3, median, upper and > > lower whisker values for various datasets simultaneously in a tab > > delimited format. After importing this text file into R, I > would like > > to plot a boxplot using these given values and not the original > > series of data points, i.e. not using something like > > boxplot(mydata). > > > > Is there an easy way for doing this? If I am not wrong, boxplot() > > does not accept these values as parameters.I believe boxplot(x,y,z) computes the required statistics and passes them to the bxp() function for plotting. If you have the statistics you can pass them to bxp() yourself. You might call trace(bxp) followed by a call to boxplot() to see how boxplot uses bxp. Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com> > > > Cheers, > > > > Dave [[alternative HTML version deleted]] > > If you use ggplot2, you can specify the aesthetics lower, > upper, middle, > ymin, and ymax directly to variables in geom_boxplot. Just > be sure to > set stat="identity" so that it does not try to summarize your > data again. > > -- > Brian Diggs > Senior Research Associate, Department of Surgery > Oregon Health & Science University > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >