[R] Histogram for each ID value

Philipp Pagel philipp.pagel at t-online.de
Mon Oct 17 19:43:49 CEST 2011



> where the first column is the chromosome location and the second column is
> some value. What I'd like to do is have a histogram created for each chr
> location (i.e. a separate histogram for chr1, chr2, chr3, chr7, chr9, and
> chr22). I am just having a hard time getting everything to work out and am
> hoping for some suggestions.

ggplot and looping combined with traditional graphics have already been
mentioned, so I'll add the lattice solution for completeness:

histogram(~foo | choromosome, dat)

This assumes that your dataframe is called "dat" and contains two
columns called "foo" (your numeric value) and "chomosome" (your
chromosome identifier).

cu
	Philipp



More information about the R-help mailing list