i suggest you'd better translate the.data format to another form like in
SAS, the data can be a number count from a fixed time like 2005-01-01, then
you can translate the datas to a sequence.

On 03-Apr-2011 5:40 PM, "Gabor Grothendieck" <ggrothendieck@gmail.com>
wrote:

On Sat, Apr 2, 2011 at 9:31 PM, Linh Tran <Tranlm@berkeley.edu> wrote:
> Hi guys,
>
> I'd like to thank you ahead of time for any help that you can offer me.
> I'm kind of stuck trying to do this.
>
> I have a data frame with dates and values (note: only two columns shown):
>
> head(test)
>        date     value         stop
> 1     01/02/05     100     12/01/07
> 2     07/16/05     200     12/01/07
> 3     12/20/05     150     12/01/07
> 4     04/01/06     250     12/01/07
> 5     10/01/06      10     12/01/07
>
> What I need to do is create regularly spaced 3-month intervals (starting
> with the first observed date) with values that are closest to but recorded
> after the date created. I would stop at the stop date. So the result would
> look like:
>
>      new_date   value
> 1     01/02/05     100
> 2     04/02/05     100
> 3     07/02/05     100
> 4     10/02/05     200
> 5     01/02/06     150
> 6     04/02/06     250
> 7     07/02/06     250
> 8     10/02/06      10
> 9     01/02/07      10
> etc
> etc
> etc   10/02/07     ---  ## Final obs since next one would be 1/2/08 (after
> stop date)
>

See question #13 in the zoo-faq vignette:
http://cran.r-project.org/web/packages/zoo/index.html
and note the existence of zoo's yearqtr class.

--
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com

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

