see ?merge

> merge(xx,aa,by.x='x',by.y='a')
            x   y   b
1 2.00112e+11 1.0 1.2
2 2.00112e+11 1.1 1.9

making the two matricies time series does not mean that R knows that the
first column is a datetime.
and depending on your desired result, that may not be important.

hope that helps,

Justin


On Thu, Jan 5, 2012 at 5:51 AM, Thijs vanden Bergh <
bergh.thijsvanden@gmail.com> wrote:

> was trying to match different matrices of different lengths with in
> the first collumn date and time info (yearmonthdayhourminute). the
> routine needs to return NA´s where data  of either of the matrices is
> non existent.
>
> have been trying the following:
>
> ####
> x <- c(200112030003, 200112030004, 200112030005, 200112030006)
> y <- c(0.1, 1, 1.1, 1.5)
> a <- c(200112030004, 200112030005, 200112030007, 200112030008,
> 200112030009)
> b <- c(1.2, 1.9, 2.0, 2.5, 2.1)
>
> xx <- cbind(x, y)
> aa <- cbind(a, b)
>
> xxnew <- ts(xx)
> aanew <- ts(aa)
>
> cc <- ts.union(xxnew, aanew)
> cc
> ####
>
> this does however not give the wished for result as it simply cbinds
> the two matrices and filles up empty spots that are created due to the
> one matrix being shorter then the other at the bottom end of the
> shortest matrix. i realy want the routine to match matrix xx and aa
> to time in the first collumn of both matrices.
>
> any help towards this end would be much appreciated,
>
> th.
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

	[[alternative HTML version deleted]]

