A caution regarding dates: in recent versions of Splus dates are in
"timeDate" format, which I have always found difficult to work with (I am
being polite here). The main problems with it are 1) it is actually two
variables somehow stuffed into a single apparent "column" in the data
frame; 2) it insists on having a time variable even if all you care about
is the date, so you get situations where daylight savings time changes or
you change time zones and things stop matching up the way they should.
Merging with timeDate, and using other functions that ought to work just
fine (such as "by" and "aggregate") get all buggered up with timeDate
variables. When I have to merge things by date (and time is not an issue)
I convert the date to year and julian day and do my calculations, then
convert back if I have to.
I do what you want to do all the time - calculate the mean for some set of
blocking variables and then merge back to the original data, usually for
the purpose of calculating anomalies (e.g., subtracting out seasonal
signals). It is easy enough to write functions to do that in one line of
code if it is something you do a lot.
Splus may seem strange and impenetrable but hang in there - pretty soon it
will seem quite familiar (although still impenetrable).
Wim
======================
Dr. Wim Kimmerer
Research Professor of Biology
Romberg Tiburon Center
San Francisco State University
3152 Paradise Drive
Tiburon CA 94920
Ph. (415) 338-3515
Fax (415) 435-7120
http://online.sfsu.edu/~kimmerer/
|