Re: [R] update index in

From: Mark Lyman <>
Date: Wed 25 Oct 2006 - 19:15:58 GMT

Kim Milferstedt <milferst <at>> writes:

> Hello,
> I have a time series of data as a data.frame. Occasionally there is
> one or more days missing (e.g. data available for days 2, 3, 4, 8, 9,
> 10 --> missing days between 4 and 8). The experimental time
> information can be found in the 2nd column of "data". I would like to
> have a continuous time line with one time point per day. Therefore I
> try to insert lines for the missing days that contain zeros for the
> data categories just to fill the columns.
> Thanks already,
> Kim

I believe this will also do what you want:

> days<-c(1:10)[-5:-7]
> xx<-rnorm(7)
> data<-data.frame(xx,days)

It usually is not a good idea to use zeroes as placeholders for missing values.

Mark Lyman mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Thu Oct 26 05:19:22 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Wed 25 Oct 2006 - 19:30:16 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.