[R] how to add data to some ts
Mark Knecht
markknecht at gmail.com
Mon Aug 31 19:47:37 CEST 2009
On Mon, Aug 31, 2009 at 6:09 AM, Bunny,
lautloscrew.com<bunny at lautloscrew.com> wrote:
> Dear all,
>
> Finally, I made it, my RPostgreSQL works. After working through some
> tutorials, i was able to plot, get and replace several timeseries.
>
>
> Still I miss the opportunity (syntax) to add data. Most tutorials are
> about: "Download some S&P data from Yahoo and play around a little".
> What I want to do is, add data to an existing timeseries. Is there a
> possibility to add data ?
>
> For example if I have something like
>
> z <- ts(rnorm(10), start = c(1990, 1), frequency = 1)
> seriesNames(z) <- "vec"
>
> I want to add the next 10 years, like
>
> z <- ts(rnorm(10), start = c(2000, 1), frequency = 1)
> seriesNames(z) <- "vec"
>
>
>
> If I use something TSreplace the new series starting at 2000 just
> replaces the existing one instead of just adding another. Is there any
> possibility to add data without reading the whole database into R ?
>
>
>
> thx in advance
>
> matt
>
> P.S.: some basic TS manipulating manuals are highly appreciated, its
> just that i found the more sophisticated ones so far.
> [[alternative HTML version deleted]]
>
How about something like
rbind(
OLD_Data,
NEW_Data
)
As long as the data has the same number of columns (Yahoo data will,
or should) then something like this should work. I use it with data
from TradeStation but there I have total control of what goes into R.
If you are not 100% sure of non-overlapping data then you might want
to check for duplicates.
Hope this helps,
Mark
More information about the R-help
mailing list