Here you will find daily news and tutorials about R, contributed by over 750 bloggers.
There are many ways to follow us - By e-mail:On Facebook: If you are an R blogger yourself you are invited to add your own R content feed to this site (Non-English R bloggers should add themselves- here)

(This article was first published on SAS and R, and kindly contributed to R-bloggers)

It’s often useful to compare histograms for some key variable, stratified by levels of some other variable. There are several ways to display something like this. The simplest may be to plot the two histograms in separate panels.

SAS In SAS, the most direct and generalizable approach is through the sgpanel procedure.

proc sgpanel data = 'c:\book\help.sas7bdat'; panelby female; histogram cesd; run;

The results are shown above.

R In R, the lattice package provides a similarly direct approach.