Dear R users,

I am new users of this software. I want to make box plot. Here, i have 
simulated data set with following commands:

x<-matrix(rnorm(90),nrow=10,ncol=9)
x
a<-matrix(c(1,1,1,1,1,2,2,2,2,2),nrow=10,ncol=1)
xx<-cbind(a,x)
colnames(xx)<-c("a","b","c","d","e","f","g","h","i","j")
rownames(xx)<-c("bro","cc","tu","so","ys","vt","ft","pc","ro","rc")
xx
factor(xx[,1])

Here, i want to make boxplot of group "1" and "2" of column "a" by using "for" 
loop because i have very large real data set.
I tried by using following "for" loop but it is not working.

> par(mfrow=c(3,2))
for(i in 2:7)
{
boxplot(xx[,i]~xx[,1],data=xx,xlab="lev")
print(i)
}
 # I am getting following message: 

Error in eval(expr, envir, enclos) : 
  only 0's may be mixed with negative subscripts

I could not find what's wrong in writing "for" loop. I think this is very 
simple for regular users. I request for finding my mistakes and correction on 
it.

Thanks,

SHANT


      
        [[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.

Reply via email to