Try this (in reality you would use the commented line
in place of the subsequent line) and then read the three
zoo vignettes and R News 4/1.

library(zoo)
library(chron)
Lines <- "Date              pH
1/02/1998      5.5
5/03/1998      5
8/12/1998      6
1/02/1999      6.1
08/10/2000    7.2"

# z <- read.zoo("myfile.dat", header = TRUE, format = "%m/%d/%Y")
z <- read.zoo(textConnection(Lines), header = TRUE, format = "%m/%d/%Y")
plot(z)


On Wed, Nov 12, 2008 at 10:40 AM, Lathouri, Maria
<[EMAIL PROTECTED]> wrote:
> Dear all,
>
> My name is Maria Lathouri and I am currently doing a PhD at Imperial College 
> of London about time series of environmental variables in surface waters. I 
> am trying to do some time plots with R but it seems that it is not working.
> The problem is that the time is not regular, for example, a small dataset can 
> be seen below:
> Date              pH
> 1/02/1998      5.5
> 5/03/1998      5
> 8/12/1998      6
> 1/02/1999      6.1
> ...
> 08/10/2000    7.2
>
> I have used the function >plot(DATE, pH) and then >lines(pH), but the line 
> does not join the points. I have used many combinations, e.g. >plot(DATE, pH) 
> and then >lines(DATE, pH), where I get a plot with full of lines inside or 
> just >plot(pH) and then >lines(pH) where the line connects the points but in 
> x-axis I do not have the DATE. It says Index from 0 to 80.
>
> Do you know if there is a function where I can have in x-axis the DATE 
> (irregular dates) and in y-axis the variable with a continuous line, showing 
> how it changes through time?

______________________________________________
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.

Reply via email to