Skip to content
Prev 366876 / 398502 Next

Challenge extracting months

Hi Kwesi,
The function collapse_values will only work on a vector of numbers
with FUN="mean". era.sta looks like a data frame with at least two
elements. As the second of these elements seems to be numeric, perhaps
this will work:

era.sta[,2]<-collapse.values(era.sta[,2],3)

Don't try to apply the names to era.sta, that was just something to
make the example easier to understand. If you want to collapse more
than one column of era.sta do each one at a time and assign them to a
new data frame. In particular, if era[,1] is a vector of month names,
you will have to create a new vector of quarter (three month) names.
If there are very many of these, the collapse_values function can be
modified to do it automatically.

Jim
On Tue, Jan 31, 2017 at 9:50 AM, Kwesi Quagraine <starskykwesi at gmail.com> wrote: