Re: [R] Generation of missiing values in a time serie...

From: Gabor Grothendieck <ggrothendieck_at_gmail.com>
Date: Tue 13 Dec 2005 - 03:31:53 EST

First we generate some sample data x and its times tt. Then using the zoo package we create an irregularly spaced time series. Now if you want a regularly spaced time series convert it to ts class. After loading zoo as shown below, the R command vignette("zoo") gives more info.

x <- 1:4
tt <- c(1, 3, 4, 6)

library(zoo)
x.zoo <- zoo(x, tt) # irregularly spaced time series
x.ts <- as.ts(x.zoo) # regular time series with NAs

On 12/12/05, Alvaro Saurin <saurin@dcs.gla.ac.uk> wrote:
>
> Hi,
>
> I am a R begginer and I have a small problem with time series. I was
> wondering if someone could help me
>
> I am collecting data from packets going through a network, and using
> R for obtaining some simple statistics of connections. However, my
> data is not collected at a constant frequency, so I would like to
> create a evenly spaced TS from my traces, using the minimum time
> difference between two samples as the period for my new TS, and
> filling the gaps with NA (or 0s).
>
> I think ther must be some simple solution for this... Anyone could
> help me?
>
> Thanks in advance.
>
> --
> Alvaro Saurin <alvaro.saurin@gmail.com> <saurin@dcs.gla.ac.uk>
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Tue Dec 13 03:49:26 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:41:35 EST