Hi Matthijs, Look at the code in the attached file and try it out. Best, Mario
On Fri, Jan 4, 2013 at 5:53 PM, Matthijs Daelman <matthijs.dael...@gmail.com > wrote: > Hi > > I have to time series with a different time base. > > The first has only sporadic datapoints: > 2011-02-01 15.29130 > 2011-02-08 17.60278 > 2011-02-15 17.99737 > 2011-02-22 25.43690 > > The other has a daily datapoint: > 2011-02-01 342.34 > 2011-02-02 68.45 > 2011-02-03 130.47 > 2011-02-04 129.86 > 2011-02-05 81.98 > 2011-02-06 77.30 > 2011-02-07 81.38 > 2011-02-08 139.95 > 2011-02-09 124.40 > ...etc. > > In Excel, it is fairly easy to get these two time series in one and the > same scatter plot, with two Y-axes, but how would you do this with R? > > Also, I would like to obtain a data frame that contains both variables: > 2011-02-01 342.34 15.29130 > 2011-02-02 68.45 NA > 2011-02-03 130.47 NA > 2011-02-04 129.86 NA > 2011-02-05 81.98 NA > 2011-02-06 77.30 NA > 2011-02-07 81.38 NA > 2011-02-08 139.95 17.60278 > 2011-02-09 124.40 NA > etc. > > I can imagine that the data frame can be obtained using (nested) loops, but > that does not seem very efficient with a large dataset. > > Any ideas? > > Thanks a lot. > > Matthijs Daelman > > [[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. > -- Mario Bourgoin, Ph.D. Department of Mathematics Brandeis University Waltham, MA
______________________________________________ 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.