Hello John,

Thank you so much for your kind assistance and the detailed descriptions.
I will play with the scripts and see which one is the easiest that serves
the purpose..

Best regards,
Janh


On Sun, Mar 24, 2013 at 7:50 AM, John Kane <jrkrideau@inbox.com> wrote:

> **
> Unless you have a really large number of wells I'd just use the brute
> force approach of reading in each data set with a simple read.table or
> read.csv  like
>
> well1  <-  read.csv("well1.csv) type of statement and repeat for each well.
>
> Here is a simple example that may give you an idea of how to do the
> boxplots . I have done them two ways, one using base graphics and the other
> using ggplot2.  You will probably have to install the ggplot2 package --
> just issue the command install.packages("ggplot2)
>
> The base approach is initially a lot simpler but in the longer term, if
> you expect to do a lot of graphing work in R, the grid packages like
> ggplot2 or lattice seem to offer a lot more control for less actual typing,
> especially if you need publication/report quality graphics.
>
> ##===============start code=====================
> set.seed(345)  #reproducable sample
>   # create three sample data sets,
>   well_1  <-  data.frame(arsenic = rnorm(12))
>   well_2  <-  data.frame (arsenic = rnorm(10))
>   well_3  <-  data.frame (arsenic = rnorm(15))
>
>   wells  <-  rbind(well_1, well_2, well_3)  # create single data.frame
>
>   #create an id value for each well
>   well_id  <- c(rep(1,nrow(well_1)), rep(2, nrow(well_2)), rep(3,
> nrow(well_3)))
>
>   #add the well identifier
>   wells  <-  cbind(wells , well_id)
>   str(wells) # check to see what we have
>
>   boxplot(arsenic ~ well_id, data = wells) # plot vertical boxplot
>   boxplot(arsenic ~ well_id, data = wells,
>             horizontal = TRUE,col=c("red","green","blue")) #horizontal box
> plot
>
>   # vertical boxplot using ggplot2
>   library(ggplot2)
>
>   p  <-  ggplot(wells, aes(as.factor(well_id), arsenic)) + geom_boxplot()
>   p
>
>   # horizontal boxplot
>   p1   <-  p + coord_flip()
>   p1
>
>   p2  <-  ggplot(wells, aes(as.factor(well_id), arsenic, fill =
> as.factor(well_id) )) +
>             geom_boxplot() + coord_flip() +
>                      scale_fill_discrete(guide=FALSE)
>
>
> ##===============end code======================
>
>
>
> John Kane
> Kingston ON Canada
>
>
> -----Original Message-----
> *From:* annijanh@gmail.com
> *Sent:* Sat, 23 Mar 2013 10:22:02 -0400
> *To:* jrkrideau@inbox.com
> *Subject:* Re: [R] boxplot
>
> Hello John,
>
> I apologize for the delayed response.  Yes I am referring to the same type
> of data in the data sets.  For example, the arsenic concentrations in
> individual groundwater monitoring wells at a groundwater contaminated site,
> where one well may have 12 concentration measurements, another well has 10,
> etc.
>
> Thanks
> Janh
>
>
> On Fri, Mar 22, 2013 at 5:31 PM, John Kane <jrkrideau@inbox.com> wrote:
>
> Hi Janh,
>
> When you say that you have "multiple data sets of unequal sample sizes"
> are you speaking of the same kind of data"  For example are you speaking of
> data from a set of experiments where the variables measured are all the
> same and where when you graph them you expect the same x and y scales?
>
> Or are you talking about essentilly independent data sets that it makes
> sense to graph in a grid ?
>
>
> John Kane
> Kingston ON Canada
>
>
> > -----Original Message-----
> > From: annijanh@gmail.com
> > Sent: Fri, 22 Mar 2013 10:46:21 -0400
> > To: dcarlson@tamu.edu
> > Subject: Re: [R] boxplot
> >
> > Hello All,
> >
> > On the subject of boxplots, I have multiple data sets of unequal sample
> > sizes and was wondering what would be the most efficient way to read in
> > the
> > data and plot side-by-side boxplots, with options for controlling the
> > orientation of the plots (i.e. vertical or horizontal) and the spacing?
> > Your
> > assistance is greatly appreciated, but please try to be explicit as I am
> > no
> > R expert.  Thanks
> >
> > Janh
> >
> >
> >
> > On Thu, Mar 21, 2013 at 9:19 AM, David L Carlson <dcarlson@tamu.edu>
> > wrote:
> >
> >> Your variable loc_type combines information from two variables (loc and
> >> type). Since you are subsetting on loc, why not just plot by type?
> >>
> >> boxplot(var1~type, data[data$loc=="nice",])
> >>
> >> ----------------------------------------------
> >> David L Carlson
> >> Associate Professor of Anthropology
> >> Texas A&M University
> >> College Station, TX 77843-4352
> >>
> >>> -----Original Message-----
> >>> From: r-help-bounces@r-project.org [mailto:r-help-bounces@r-
> >>> project.org] On Behalf Of Jim Lemon
> >>> Sent: Thursday, March 21, 2013 4:05 AM
> >>> To: carol white
> >>> Cc: r-help@stat.math.ethz.ch
> >>> Subject: Re: [R] boxplot
> >>>
> >>> On 03/21/2013 07:40 PM, carol white wrote:
> >>>> Hi,
> >>>> It must be an easy question but how to boxplot a subset of data:
> >>>>
> >>>> data = read.table("my_data.txt", header = T)
> >>>> boxplot(data$var1[data$loc == "nice"]~data$loc_type[data$loc ==
> >>> "nice"])
> >>>> #in this case, i want to display only the boxplot loc == "nice"
> >>>> #doesn't display the boxplot of only loc == "nice". It also displays
> >>> loc == "mice"
> >>>>
> >>> Hi Carol,
> >>> It's them old factors sneakin' up on you. Try this:
> >>>
> >>> boxplot(data$var1[data$loc == "nice"]~
> >>>   as.character(data$loc_type[data$loc == "nice"]))
> >>>
> >>> Jim
> >>>
> >>> ______________________________________________
> >>> R-help@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.
> >>
> >> ______________________________________________
> >> R-help@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.
> >>
> >
> >       [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > R-help@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.
>
> ____________________________________________________________
> FREE 3D EARTH SCREENSAVER - Watch the Earth right on your desktop!
> Check it out at http://www.inbox.com/earth
>
>
>
>  ------------------------------
>  Get Free 5GB Email – Check out spam free email with many cool features!
> Visit http://www.inbox.com/email to find out more!
>

	[[alternative HTML version deleted]]

