[R] How to separate a data set by its factors
James Rome
jamesrome at gmail.com
Thu Dec 24 21:24:30 CET 2009
I have a large data set of airport data and wish to analyze it by hour
and day of the week. hour and day of the week are factors.
I can do something such as:
histogram(~(Arrival.Val) | DAY*Hour, type="count", breaks=60)
which displays the data the way I want it in principle, but the plots
are too small to read. I added layout=c(7,6,4) to the argument list, but
then I only get the first page of plots. How do I see the other pages?
And I would like to add a Poisson Distribution fit to each of these
plots (see below), but am clueless as to how to go about it.
I would like to fit a distribution to the count data for each
combination of day and hour, and I am unable to see how to do this in a
vector manner. For example, I tried
density((Arrival.Val | DAY*Hour), na.rm=TRUE)
which does not work.
I think my question boils down to "how do you replace a whole data set
by its factored subsets in all of the usual R commands?
I am climbing up a steep R learning curve, and so would appreciate some
help.
Thanks,
Jim
§
More information about the R-help
mailing list