[R] plotting variable sections of hourly time series data using plot.zoo

From: <Jan.Schwanbeck_at_hydrologie.unibe.ch>
Date: Thu, 31 May 2007 15:54:13 +0200

Dear list,

I have to look examine hourly time - series and would like to plot variable section of them using plot.zoo.

Hourly time series data which looks like this:

YYYY MM DD HH    P-uk    P-kor   P-SME   EPOT    EREA     RO     R1
R2      RGES   S-SNO     SI    SSM       SUZ    SLZ
 2003  1  1  1        0.385   0.456   0.021   0.000   0.000   0.000   0.013
0.223   0.235    0.01    0.38   74.72    0.96  736.51
 2003  1  1  2        0.230   0.275   0.028   0.000   0.000   0.000   0.012
0.223 0.235 0.03 0.56 74.72 0.94 736.37

#With help of read.table I got the data into R :

DF <- read.table(file=fn,header=FALSE,skip=2)

#Substitute the header:

names(DF) <-

#Create datetime vector

DF$datetime <- with(DF,chron(paste(month,day,year,sep="/"))+hour/24)

#Try to convert DF into ts - object DFts

DFts <- as.ts(DF) # works, but gives back: Warning message: Class information of one or more columns was lost.???

#Try to convert DF into zoo - object DFzoo

DFzoo <- as.zoo(DFts)

#Plot of whole time series skipping first 5 and last 3 columns

plot.zoo(DFzoo[ ,6:ncol(myDFzoo-3)])

# works, but x-axis labels are numbers from 1 to ...last hour

I would like to use plot.zoo for plotting: - the whole period (3years) --> axis-labels month and year - section of few days defining begin and end as date --> axis-label day and month (may be hour)

Afer long tries with "as.Date" and Co. I still didn't get any useful result.

Further is there any possibility to define the plot window using two variables like:

begin <- "22/2/2003 01:00:00"
end <- "26/3/2003 07:00:00"

to plot the time series section in between this two dates?

I am even not sure if the zoo package was the right choise for my problem.

Thanks a lot in advance

Best regards


University of Berne

R-help_at_stat.math.ethz.ch 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. Received on Thu 31 May 2007 - 14:15:55 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 31 May 2007 - 15:31:35 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.