search for: tshour

Displaying 1 result from an estimated 1 matches for "tshour".

2010 Mar 10
3
Help with aggregate and cor
...ve observations of pairs of variables, v1, o1, v2, o2, etc, observed every 30 seconds. What I would like to do is compute the correlation matrix, but not for all my data, just for, say 5 minutes or 1 hour chunks. In sql, what I would say is select id, date_trunc('hour'::text, ts) as tshour, corr(n1,o1) as corr1 from raw30s where id = 1201087 and (ts between 'Mar 1, 2007' and 'Apr 1, 2007') group by id,tshour order by id,tshour; I've pulled data from PostgreSQL into R, and have a dataframe containing a timestamp column, v, and o (both num...