[R] need help with a time series plotting problem
vibhava
vibhavasrivastava at gmail.com
Sat Dec 24 19:20:10 CET 2011
sorry about the change in variable name (data has column named usgs700 but
code has usgs700). actually i am trying to get familiar with R as i need to
make more complex time series plots in near future (stackplots, scatterplot
etc.). Let me try to explain what i am intending to achieve here. below i
have copied first few lines of a large dataset (daily flow records for 4017
days at 8 usgs locations). first column is date and rest of them are flow
data measured at these 8 different location. now all i wish to do is to read
them in and make time series plots for the entire period of record for each
stations. i have attached some figures that i made in excel and i wish to do
something like this using R.
I know my code might have some errors and that's the reason why i am
requesting for help from people who know R better than I do. i am R user for
less than a day but i know what i am trying to do is really simple and all i
need is to read 9 columns and make a simple time series plot.
i would appreciate if anyone can correct the code that i have written below
or if they have some alternate way of doing this i would be happy to learn
something new
regards
vibhava
Date USGS700 USGS1000 USGS1500 USGS 1898 USGS1975 USGS2500 USGS2700 USGS2800
10/1/2000 0.05 0.57 2.32 2.27 4.11 29.45 29.45 29.45
10/2/2000 0.04 0.54 2.12 1.70 4.05 29.17 29.17 29.17
10/3/2000 0.03 0.48 1.93 1.98 3.96 28.88 28.88 28.88
10/4/2000 0.03 0.45 1.76 1.42 3.91 28.60 28.60 28.60
10/5/2000 0.03 0.42 1.64 1.27 3.82 28.32 28.32 28.32
10/6/2000 0.03 0.42 1.53 1.13 3.74 28.26 28.26 28.26
10/7/2000 0.11 0.51 1.59 5.66 3.68 28.23 28.23 28.23
10/8/2000 0.16 0.45 1.70 3.40 3.62 27.84 27.84 27.84
10/9/2000 0.10 0.42 1.78 2.55 3.54 26.56 26.56 26.56
> setwd("J:/Rstuff/flow")
> # defining the working directory
> flow=read.delim("flow.dat",header=TRUE,sep="\t")
> # opening the above tab separated data file
> 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")
> #just to test my code, i am trying to make time series
#plot of 1 variable USGS1500
http://r.789695.n4.nabble.com/file/n4231737/flow.docx flow.docx
--
View this message in context: http://r.789695.n4.nabble.com/need-help-with-a-time-series-plotting-problem-tp4230672p4231737.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list