[R] gap.boxplot error message?

Megan J Bellamy bellammj at gov.ns.ca
Wed Jun 25 17:42:03 CEST 2008


I don't believe so. Sorry if I am missing something (I am a beginner user of R). I tried just putting in all the defaults as see on http://bm2.genes.nig.ac.jp/RGM2/R_current/library/plotrix/man/gap.boxplot.html 

Here is a copy of my script and how the graph looks right now (without the break in the axis). There are two images. One is with the entire axis shown (with outliers) and the other is without outliers.

The script is:
# Create box-and-whisker plot CLI class areas
# for all of Nova Scotia
# Written by Megan Bellamy

# Import *.csv files containing areas for each CLI class
cli3<-read.table("F:\\Megan\\cli3.csv", header=TRUE, row.names=1, sep=",")
cli4<-read.table("F:\\Megan\\cli4.csv", header=TRUE, sep=",")
cli5<-read.table("F:\\Megan\\cli5.csv", header=TRUE, sep=",")
cli6<-read.table("F:\\Megan\\cli6.csv", header=TRUE, sep=",")
cli7<-read.table("F:\\Megan\\cli7.csv", header=TRUE, sep=",")

# Attach these to the dataframe
attach(cli3)
attach(cli4)
attach(cli5)
attach(cli6)
attach(cli7)


# Calculate box and whisker values for each file


CLI3<-(quantile(hectares))

CLI4<-(quantile(hectares2))

CLI5<-(quantile(hectares3))

CLI6<-(quantile(hectares4))

CLI7<-(quantile(hectares5))


# Set margins for plot area
par(mar=c(5, 5, 3, 1))

# Plot box-and-whisker with areas being blue
# label X-axis according to CLI class(es) being plotted, and let the Y-axis be the default,
# showing area in hectares

boxplot(CLI3, CLI4, CLI5, CLI6, CLI7, col="white",ann=FALSE, axes=FALSE, outline=TRUE)
axis(1, at=1:5, lab=c("3", "4", "5", "6", "7"))
axis(2, at=NULL)

#axis(2,tck=0.01,mgp=c(1,0.5,0),las=2)

box()

title(main="CLI classes by Area",col="black", font.main=2)
title(xlab= "Canadian Land Inventory Class", col="black")
title(ylab="Area in hectares(ha)", col="black")

#install.packages("plotrix")
#axis.break(axis=2, breakpos=8000, bgcol="white", breakcol="black", style="gap", brw=0.02)
#gap.boxplot(CLI3, CLI4, CLI5, CLI6, CLI7, gap=list(top=c(8000,280000), bottom=c(0,250)), range=50, outline=TRUE, par(ask=FALSE)

-------------------------
Megan Bellamy



>>> "stephen sefick" <ssefick at gmail.com> 06/25/08 10:13 AM >>>
is there an na.rm argument in gap.boxplot?

On Wed, Jun 25, 2008 at 11:24 AM, Megan J Bellamy <bellammj at gov.ns.ca>
wrote:

> Hi Stephen,
>
> I tried what you suggested and got a different error message instead... any
> ideas?
>
> > gap.boxplot(CLI3, CLI4, CLI5, CLI6, CLI7, gap=list(top=c(8000,280000),
> bottom=c(0,250)), range=50, outline=TRUE)
> Error in bxgap$out[bxgap$out > gap$top[2]] <- bxgap$out[bxgap$out >
> gap$top[2]] -  :
>  NAs are not allowed in subscripted assignments
>
>
> >>> "stephen sefick" <ssefick at gmail.com> 06/25/08 9:48 AM >>>
> the par(ask=FALSE) doesn't belong in the code (I think).
> gap.boxplot(CLI3, CLI4, CLI5, CLI6, CLI7, gap=list(top=c(8000,280000),
> bottom=c(0,250)), range=50, outline=TRUE)
>
> but I haven't tried this.
>
> Stephen
> On Wed, Jun 25, 2008 at 10:49 AM, Megan J Bellamy <bellammj at gov.ns.ca>
> wrote:
>
> > Hello,
> >
> > When I put in the following script line:
> > gap.boxplot(CLI3, CLI4, CLI5, CLI6, CLI7, gap=list(top=c(8000,280000),
> > bottom=c(0,250)), range=50, outline=TRUE, par(ask=FALSE)
> >
> > I get a '+' telling me I am missing something. I have tried adding ')',
> > 'width=NULL', etc and then I get this error:
> > Error: unexpected symbol in:
> > "gap.boxplot(CLI3, CLI4, CLI5, CLI6, CLI7, gap=list(top=c(8000,280000),
> > bottom=c(0,250)), range=50, outline=TRUE, par(ask=FALSE)
> > box"
> >
> > Any ideas? I have read over the Graphical Manual and am going through
> > 'Modern Applied Statistics with S' but I can't figure out where I am
> going
> > wrong...
> >
> > Megan Bellamy
> >
> > ______________________________________________
> > 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.
> >
>
>
>
> --
> Let's not spend our time and resources thinking about things that are so
> little or so large that all they really do for us is puff us up and make us
> feel like gods. We are mammals, and have not exhausted the annoying little
> problems of being mammals.
>
> -K. Mullis
>
>


-- 
Let's not spend our time and resources thinking about things that are so
little or so large that all they really do for us is puff us up and make us
feel like gods. We are mammals, and have not exhausted the annoying little
problems of being mammals.

-K. Mullis



More information about the R-help mailing list