[R] need help with a time series plotting problem

Jim Holtman jholtman at gmail.com
Sat Dec 24 12:09:27 CET 2011


you need to supply a subset of your data since the problem is probably related to its representation.  please follow the posting guidelines.

Sent from my iPad

On Dec 24, 2011, at 2:21, vibhava <vibhavasrivastava at gmail.com> wrote:

> Dear R Users,
>                     I am a beginner in R programming and need some help
> with a simple plotting problem that i am having. My dataset consist of three
> columns: first one has data_id, second is the date and third is the actual
> data itself corresponding to each date. The date ranges from
> 1/1/2000-12/31/2009. I am trying to plot my data versus the dates as a long
> term time series but what's happening is that R is plotting each year on top
> of the previous year. so instead of getting 1 line (dated 2000-2009) in the
> plot i am getting 9 lines (1 line for each year). i tried to look for
> solutions online but found nothing. can someone suggest how can i make a
> plot with x-axis ranging from 2000-2009. my code is copied below:
> 
> setwd("J:/Rstuff/flow")
> flow=read.delim("flow.dat",header=TRUE,sep="\t")
> plot(flow$usgs1500~as.Date(flow$date,
> "%m/%d/%y"),type="l",xlab="date",ylab="daily discharge (m3/s)
> ",main="USGS1500",yaxs="i", xaxs="i",)
> 
> 
> any help would be appreciated
> 
> regards
> 
> vibhava  
> 
> --
> View this message in context: http://r.789695.n4.nabble.com/need-help-with-a-time-series-plotting-problem-tp4230672p4230672.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> ______________________________________________
> 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.



More information about the R-help mailing list