On Wed, Jun 30, 2010 at 4:02 PM, skan <juanp...@gmail.com> wrote:
>
> Hello
>
> I have two series (that can have with different frequencies or with missing
> values).
> I merge them and use na.locf, getting a zoo objet with a common index and
> two core columns.
> How can I add this columns getting a new zoo series?
> Any other way of adding two asynchronou series?
>

Try this:

z <- zoo(cbind(1:3, 4:6))
z[, 1] + z[, 2]

If x and y are two zoo series you can do this:

x <- zoo(1:3, c(1, 2, 4))
y <- zoo(4:6, c(1, 2, 3))
x + y

and it will automatically merge them when it adds them using all =
FALSE; however, if you use merge explicitly then the default is all =
TRUE or you can override that with merge(..., all = FALSE) so which
way to go depends on what you want.  You can also do left and right
joins.  See help(merge.zoo)

______________________________________________
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.

Reply via email to