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]]
Gabor Grothendieck
2008-Jul-29 13:18 UTC
[R] combining zoo series with an overlapping index?
Try: window(d, time(lin)) <- coredata(lin) On Tue, Jul 29, 2008 at 9:01 AM, stephen sefick <ssefick at gmail.com> wrote:> 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. >
Possibly Parallel Threads
- Interpolating a line and then summing there values for a diurnal oxygen curve (zoo object)
- Dotchart per groups
- Wilcoxon test and grouping factor with multiple levels
- Slow RAID Check/high %iowait during check after updgrade from CentOS 6.5 -> CentOS 7.2
- [LLVMdev] [llvm-commits] [PATCH] BasicBlock Autovectorization Pass