Skip to content

time series - cbind

3 messages · Joe Stuart, David Winsemius

#
Hi,
I have a time series ts.score that gets created based on a function.
When I print the time series out it prints two rows, first the date
then the value.

2011-06-14
-1.25947868

The function gets called multiple times in my script and I'm trying to
append the time series to an object called ts.bind using the cbind
function like so. The only problem I have is that the date is an index
for all of the columns, which is only correct for the first column. Is
there a way that I can associate the correct dates with each column?

ts.bind <- cbind(ts.bind, ts.score)

? ? ? ? ? ? ? ? ? ? ? ?ts.score ? ? ? ? ?ts.score ? ? ? ? ?ts.score
 ? ?ts.score ? ? ? ?ts.score
2010-10-14 ? 1.06493449 ? 0.96323675 ? 1.13255734 ? -0.3060238 ? ?1.0083540
2010-10-15 ? 0.51371978 ?-0.54348798 ? 0.82563515 ? -0.8808261 ? ?0.9578659
2010-10-18 ? 0.03667826 ? 0.25904910 ? 0.56100008 ? -1.0084433 ? ?0.5220185
2010-10-19 ?-2.32490163 ? 0.08469947 ? 0.09021838 ? -1.7677688 ? ?0.7954248
2010-10-20 ?-1.52627229 ? 0.15408516 ? 0.16440753 ? -1.4923426 ? ?0.5221617

I appreciate any help.
#
On Oct 28, 2011, at 10:32 AM, Joe Stuart wrote:

            
You should look at the 'zoo' package. It supplies merge and cbind  
methods for its zoo-class objects that will properly align values by  
their index. Many people have experienced the problems you are  
currently seeing and .... "zoo" is the solution.
David Winsemius, MD
West Hartford, CT
#
I will. Thanks

On Fri, Oct 28, 2011 at 10:18 AM, David Winsemius
<dwinsemius at comcast.net> wrote: