On Mon, Mar 19, 2012 at 8:03 PM, Sam Albers <tonightstheni...@gmail.com>wrote:

> Hello R-ers,
>
> I just wanted to update this post. I've made some progress on this but
> am still not quite where I need to be. I feel like I am close so I
> just wanted to share my work so far.
>
>
Try this:

Lines <- "Date      Dis1
1967-06-05  1.146405
1967-06-06  9.732887
1967-06-07 -9.279462
1967-06-08  7.856646
1967-06-09  5.494370
1967-06-15  5.070176
1967-06-16  3.847314
1967-06-17 -5.243094
1967-06-18  9.396560
1967-06-19  4.112792"

# read in data
library(zoo)
z <- read.zoo(text = Lines, header = TRUE)

# process it
g <- seq(start(z), end(z), "day") # all days
zg <- merge(z, zoo(, g)) # fill in missing days
lag(zg, 0:-2)[time(z)]

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

        [[alternative HTML version deleted]]

______________________________________________
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