[R] subscripted assignments errormessage in gap.boxpot

Megan J Bellamy bellammj at gov.ns.ca
Wed Jun 25 19:36:12 CEST 2008


I am trying to create a boxplot that has a gap with different scales so that my boxes actually show (compare attachments). I have referred to the help pages for gap.boxplot, gap.plot, list with no luck so far. Here is my script and the resulting error message:

# Import *.csv files containing areas for each CLI class
cli3<-read.table("F:\\Megan\\cli3.csv", header=TRUE, 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))

#classes<-list(cli3, cli4, cli5, cli6, cli7)

classes<-c(cli3, cli4, cli5, cli6, cli7)
gap.boxplot(classes,gap=list(top=c(8000,28000), bottom=c(0,250)), range=5, main=NULL)

#par(ask=FALSE)

-----
Error in bxgap$out[bxgap$out > gap$top[2]] <- bxgap$out[bxgap$out > gap$top[2]] -  : 
  NAs are not allowed in subscripted assignments

I am not quite sure what 'subscripted assignments' means. I tried substituting the 'classes<-list...' for the 'classes<-c(cli3...)' and got this error instead: Error in sort.list(x) : 'x' must be atomic for 'sort.list'
Have you called 'sort' on a list?

I have tried looking up the help for lists and is.list but am not sure what I am missing.


More information about the R-help mailing list