As another respondent already mentioned, Lattice is probably the way to go on this one but if you do want to use tapply try this:
names(Pot) <- SGruppo dummy <- tapply(Pot,SGruppo,function(x)hist(x,main=names(x)[1],xlab=NULL)) Vittorio <v.demartino2 <at> virgilio.it> writes: : : I'm learning how to use tapply. : Now I'm having a go at the following code in which dati contains almost 600 : lines, Pot - numeric - are the capacities of power plants and SGruppo - text : - the corresponding six technologies ("CCC", "CIC","TGC", "CSC","CPC", "TE"). : ..................................................... : : dati=sqlQuery(canale,"select Id,SGruppo,Classe, NGruppo,ProdNetta,Pot from : SintesiQuery") : attach(dati) : # Grouping by technology : tapply(Pot,SGruppo,sum) : ................................... : # Histograms by technology : par(mfrow=c(2,3)) : tapply(Pot,SGruppo,hist) : detach(dati) : : It all works great but tapply(Pot,SGruppo,hist) produces 6 histograms with : the titles and the xlab labels in a generic form, something like integer[1], : integer[2], ....... while I'd like to have each graph indicating the : mentioned technologies. : I've been trying issuing : tech=c("CCC", "CIC","TGC", "CSC","CPC", "TE") : tapply(Pot,SGruppo,hist, main=tech) : : but R prints in each histogram the six values in the title without cycling : among them. : : How can I obtain what I want? : : Ciao : Vittorio ______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html