[R] Doing box plots for part of the data??

Jim Lemon jim at bitwrit.com.au
Fri Apr 4 05:54:34 CEST 2014


On 04/04/2014 02:20 PM, David Doyle wrote:
> HI folks
>
> I'm wanting to do box plots of just 2 of my wells.
>
> I can do it for all of them by using
>
> boxplot(Barium~Well.ID,data=mydata, main="Barium", ylab="mg/L")
>
> to do for all 4 wells
> Anyone have a sugestion on how to do it for only 2 wells like MW-1 and MW-2?
>
> The data can be found?
> http://www.doylesdartden.com/TEMP/mydata.csv
>

Hi David,
Try this:

dddf<-read.csv("mydata.csv")
dddf12<-dddf[dddf$Well.ID=="MW-1" | dddf$Well.ID=="MW-2",]
dddf12$Well.ID<-factor(dddf12$Well.ID,levels=c("MW-1","MW-2"))
boxplot(Barium~Well.ID,dddf12)

Jim




More information about the R-help mailing list