-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
project.org] On Behalf Of Simon Kiss
Sent: Thursday, April 11, 2013 12:35 PM
To: r-help@r-project.org
Subject: [R] Adding time series to time graphs
Hello: I have done this before but cannot figure out how to do it
again.
I would like to graph campaign evolution of news stories on certain
topics. The campaign time period is as follows:
campaign-seq.Date(from=as.Date('2011-09-06'), to=as.Date('2011-10-5'),
by=1)
I have a table of newspaper story frequencies containing a certain word
that can be turned into a data.frame (or not). I'll reproduce it as a
data.frame
plotdf-data.frame(story.dates=seq.Date(as.Date('2011-09-
17'),as.Date('2011-09-30'), by=1), Freq=seq(1,14, by=1))
How do I overlay the frequency of newspaper stories in a line plot on a
graph where the x-axis is a series of dates twice as long as the time
series itself? The reason I'd like this is because I'd like to add a
couple of other story time series as well. They may appear at other
points in time in the campaign as well.
Thanks.
Simon Kiss
Maybe use the xlim parameter with plot?
with(plotdf, plot(story.dates,Freq, type='l', xlim=range(campaign)))
Hope this is helpful,
Dan
Daniel J. Nordlund
Washington State Department of Social and Health Services
Planning, Performance, and Accountability
Research and Data Analysis Division
Olympia, WA 98504-5204
__
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.