Re: [R] Lattice: reversing order of panel placement in conditional histograms
On 7/23/05, Prof Brian Ripley [EMAIL PROTECTED] wrote: From what I understand, you want to set up a factor with the levels reversed. It is not that `5 is larger than 1', but that you created a factor with the levels in alphabetic order. Lattice plots in the order of the levels. Something like f - factor(f, levels=rev(levels(f))) will do this. For the horizontal factor, give the levels in the order you want them to appear (which might not be the reverse of alphabetic). On Sat, 23 Jul 2005, Sam Ferguson wrote: I have a question about lattice in general, and histogram specfically. How do you control the ordering of factors that controls the placement of the conditional panels. I have a dataset with factors that go 'Q1','Q2',Q3','Q5' and of course I want the plot to place Question Q1 at the top and Question Q5 at the bottom of the graphical output. One additional comment: if you think top to bottom is the natural order (which lattice doesn't), try using as.table = TRUE Deepayan histogram() does the opposite as 5 is larger than 1. Similarly my 'AlertFormat' factor is a textual category, and I need the data to read from left to right (representing old to new) , with 'New A V' on the right, and 'Pre-existing A V' on the left, which is the opposite to how histogram plots. [...] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Lattice: reversing order of panel placement in conditional histograms
From what I understand, you want to set up a factor with the levels reversed. It is not that `5 is larger than 1', but that you created a factor with the levels in alphabetic order. Lattice plots in the order of the levels. Something like f - factor(f, levels=rev(levels(f))) will do this. For the horizontal factor, give the levels in the order you want them to appear (which might not be the reverse of alphabetic). On Sat, 23 Jul 2005, Sam Ferguson wrote: I have a question about lattice in general, and histogram specfically. How do you control the ordering of factors that controls the placement of the conditional panels. I have a dataset with factors that go 'Q1','Q2',Q3','Q5' and of course I want the plot to place Question Q1 at the top and Question Q5 at the bottom of the graphical output. histogram() does the opposite as 5 is larger than 1. Similarly my 'AlertFormat' factor is a textual category, and I need the data to read from left to right (representing old to new) , with 'New A V' on the right, and 'Pre-existing A V' on the left, which is the opposite to how histogram plots. The current lattice output from what's below is here:- http://www.arch.usyd.edu.au/~sfer9710/latticeoutput.pdf All I really want to do is reverse the placement entirely from what I have received above. I've checked the help to no avail, and have looked through the r-help archive. I love lattice, but always have problems of this nature. I hope someone can help me solve them. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Lattice: reversing order of panel placement in conditional histograms
Hi R-people, I have a question about lattice in general, and histogram specfically. How do you control the ordering of factors that controls the placement of the conditional panels. I have a dataset with factors that go 'Q1','Q2',Q3','Q5' and of course I want the plot to place Question Q1 at the top and Question Q5 at the bottom of the graphical output. histogram() does the opposite as 5 is larger than 1. Similarly my 'AlertFormat' factor is a textual category, and I need the data to read from left to right (representing old to new) , with 'New A V' on the right, and 'Pre-existing A V' on the left, which is the opposite to how histogram plots. The current lattice output from what's below is here:- http://www.arch.usyd.edu.au/~sfer9710/latticeoutput.pdf All I really want to do is reverse the placement entirely from what I have received above. I've checked the help to no avail, and have looked through the r-help archive. I love lattice, but always have problems of this nature. I hope someone can help me solve them. Thanks heaps -- Sam version _ platform powerpc-apple-darwin7.9.0 arch powerpc os darwin7.9.0 system powerpc, darwin7.9.0 status Patched major2 minor1.0 year 2005 month05 day 12 language R aaRatings Question X.Alert.Format. Response 1Q1 New A V3 2Q1 New A V3 3Q1 New A V3 4Q1 New A V3 5Q1 New A, Pre-existing V3 6Q1 New A, Pre-existing V3 7Q1 New A, Pre-existing V2 8Q1 New A, Pre-existing V2 9Q1 New V, Pre-existing A3 10 Q1 New V, Pre-existing A2 11 Q1 New V, Pre-existing A2 12 Q1 New V, Pre-existing A2 13 Q1Pre-existing A V1 14 Q1Pre-existing A V -2 15 Q1Pre-existing A V -2 16 Q1Pre-existing A V -2 17 Q2 New A V3 18 Q2 New A V3 19 Q2 New A V3 20 Q2 New A V3 21 Q2 New A, Pre-existing V3 22 Q2 New A, Pre-existing V2 23 Q2 New A, Pre-existing V2 24 Q2 New A, Pre-existing V1 25 Q2 New V, Pre-existing A3 26 Q2 New V, Pre-existing A2 27 Q2 New V, Pre-existing A2 28 Q2 New V, Pre-existing A2 29 Q2Pre-existing A V1 30 Q2Pre-existing A V -2 31 Q2Pre-existing A V -2 32 Q2Pre-existing A V -2 33 Q3 New A V3 34 Q3 New A V3 35 Q3 New A V3 36 Q3 New A V3 37 Q3 New A, Pre-existing V3 38 Q3 New A, Pre-existing V3 39 Q3 New A, Pre-existing V3 40 Q3 New A, Pre-existing V2 41 Q3 New V, Pre-existing A3 42 Q3 New V, Pre-existing A3 43 Q3 New V, Pre-existing A3 44 Q3 New V, Pre-existing A2 45 Q3Pre-existing A V2 46 Q3Pre-existing A V1 47 Q3Pre-existing A V -2 48 Q3Pre-existing A V -3 49 Q5 New A V3 50 Q5 New A V3 51 Q5 New A V3 52 Q5 New A V3 53 Q5 New A, Pre-existing V3 54 Q5 New A, Pre-existing V3 55 Q5 New A, Pre-existing V1 56 Q5 New A, Pre-existing V1 57 Q5 New V, Pre-existing A3 58 Q5 New V, Pre-existing A2 59 Q5 New V, Pre-existing A2 60 Q5 New V, Pre-existing A2 61 Q5Pre-existing A V1 62 Q5Pre-existing A V -1 63 Q5Pre-existing A V -1 64 Q5Pre-existing A V -3 attach(aaRatings) histogram(Response|X.Alert.Format.+Question,type=count,nint=8) __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html