[R] combining zoo series with an overlapping index?

From: stephen sefick <ssefick_at_gmail.com>
Date: Tue, 29 Jul 2008 09:01:48 -0400


day<-structure(c(7.7, 7.7, 7.7, 7.7, 7.7, 7.71, 7.7, 7.71, 7.71, 7.7,

7.7, 7.7, 7.7, 7.69, 7.68, 7.68, 7.67, 7.67, 7.67, 7.66, 7.65,
7.65, 7.65, 7.64, 7.64, 7.63, 7.63, 7.63, 7.62, 7.62, 7.62, 7.62,
7.63, 7.63, 7.63, 7.63, 7.63, 7.64, 7.64, 7.65, 7.65, 7.65, 7.66,
7.66, 7.67, 7.67, 7.67, 7.68, 7.68, 7.69, 7.69, 7.69, 7.69, 7.7,
7.7, 7.7, 7.7, 7.7, 7.71, 7.7, 7.7, 7.71, 7.71, 7.7, 7.7, 7.7,
7.7, 7.7, 7.7, 7.7, 7.69, 7.68, 7.68, 7.68, 7.67, 7.67, 7.66,
7.66, 7.66, 7.66, 7.65, 7.65, 7.65, 7.65, 7.66, 7.66, 7.66, 7.67,
7.67, 7.68, 7.68, 7.68, 7.68, 7.69, 7.69, 7.69), index =
structure(c(13307.0006944444,
13307.0111111111, 13307.0215277778, 13307.0319444444, 13307.0423611111,
13307.0527777778, 13307.0631944444, 13307.0736111111, 13307.0840277778,
13307.0944444444, 13307.1048611111, 13307.1152777778, 13307.1256944444,
13307.1361111111, 13307.1465277778, 13307.1569444444, 13307.1673611111,
13307.1777777778, 13307.1881944444, 13307.1986111111, 13307.2090277778,
13307.2194444444, 13307.2298611111, 13307.2402777778, 13307.2506944444,
13307.2611111111, 13307.2715277778, 13307.2819444444, 13307.2923611111,
13307.3027777778, 13307.3131944444, 13307.3236111111, 13307.3340277778,
13307.3444444444, 13307.3548611111, 13307.3652777778, 13307.3756944444,
13307.3861111111, 13307.3965277778, 13307.4069444444, 13307.4173611111,
13307.4277777778, 13307.4381944444, 13307.4486111111, 13307.4590277778,
13307.4694444444, 13307.4798611111, 13307.4902777778, 13307.5006944444,
13307.5111111111, 13307.5215277778, 13307.5319444444, 13307.5423611111,
13307.5527777778, 13307.5631944444, 13307.5736111111, 13307.5840277778,
13307.5944444444, 13307.6048611111, 13307.6152777778, 13307.6256944444,
13307.6361111111, 13307.6465277778, 13307.6569444444, 13307.6673611111,
13307.6777777778, 13307.6881944444, 13307.6986111111, 13307.7090277778,
13307.7194444444, 13307.7298611111, 13307.7402777778, 13307.7506944444,
13307.7611111111, 13307.7715277778, 13307.7819444444, 13307.7923611111,
13307.8027777778, 13307.8131944444, 13307.8236111111, 13307.8340277778,
13307.8444444444, 13307.8548611111, 13307.8652777778, 13307.8756944444,
13307.8861111111, 13307.8965277778, 13307.9069444444, 13307.9173611111,
13307.9277777778, 13307.9381944444, 13307.9486111111, 13307.9590277778,
13307.9694444444, 13307.9798611111, 13307.9902777778), format =
structure(c("m/d/y",
"h:m:s"), .Names = c("dates", "times")), origin = structure(c(1,
1, 1970), .Names = c("month", "day", "year")), class = c("chron",
"dates", "times")), class = "zoo")

#Mullholland ER daytime

# extract section of interest

w <- window(day, start=chron("6/8/6", "4:16:0"), end=chron("6/8/6",
"20:31:0"))

# zap all interior points with NA's and then fill back in using linear interpolation

lin <- na.approx(replace(w, time(w) > start(w) & time(w) < end(w), NA))

# plot the 3 series on one screen

#plot(merge(day, w, lin), col = 1:3, screen = 1)

#can I do this with a command (generically?)? I am going to use this inside of a function, and below is the result I would like. d<- c(day[1:17,], lin, day[84:96,])
plot(d)

-- 
Let's not spend our time and resources thinking about things that are so
little or so large that all they really do for us is puff us up and make us
feel like gods. We are mammals, and have not exhausted the annoying little
problems of being mammals.

-K. Mullis

	[[alternative HTML version deleted]]

______________________________________________
R-help_at_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.
Received on Tue 29 Jul 2008 - 13:04:37 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 29 Jul 2008 - 14:32:48 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive