Thanks a lot for the quick response! The suggested code worked fine up to a certain point: the actual plotting from the datasets... With the sample dataset in "samp" my code looks like this at the end:
> for(cultivar in 1:6) + boxplot(unlist(samp[samp$cn==cultivar[cultivar],]), + add=TRUE,at=cultivar) There were 12 warnings (use warnings() to see them) > warnings() Warning messages: 1: In min(x) : no non-missing arguments to min; returning Inf 2: In max(x) : no non-missing arguments to max; returning -Inf . . . . . What is happening and why? /CG ________________________________________ Från: Jim Lemon [...@bitwrit.com.au] Skickat: den 11 januari 2010 10:56 Till: Carl-Göran CG. Pettersson Kopia: r-help@r-project.org Ämne: Re: [R] Illustrating kernel distribution in wheat ears On 01/11/2010 06:47 PM, Carl-Göran CG. Pettersson wrote: > Dear all > > R2.10 WinXP > > I have a dataset dealing with the way different wheat cultivars build their > yield. > Wheat ears are organised in spikelets where the spikelets can be numbered > from the bottom, with even numbers on one side and odd on the other. > I know how many kernels there were in each spikelet after some months spent > counting them... > > Now I want to illustrate the differences between the cultivars in how the > kernels are distributed in the ears. > In the best of all possible worlds it would be possible to place histograms > or boxplots on adjecent sides of vertical lines representing different > cultivars. > I have done some experimenting using boxplot() but I am stuck and out of > ideas right now. > > Hi Carl, Is this what you are looking for? plot(0,xlim=c(0.5,6.5),ylim=c(0,6), main="Kernel distribution",xlab="Cultivar", ylab="Count",type="n",xaxt="n") cultivars<-unique(spikernel$cn) axis(1,at=1:6,labels=cultivars) for(cultivar in 1:6) boxplot(unlist(spikernel[spikernel$cn==cultivars[cultivar],]), add=TRUE,at=cultivar) abline("v"=1.5:5.5) 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.