[R] Time plots

2008-11-17 Thread Lathouri, Maria
Dear all, 
I want to do some time plots and actually the dates are in the format of 
dd/mm/. So first I input my dataframe in R in a csv form. What I do is 
 
DF-read.csv(C:/Documents and Settings/DF.csv)
DATE-as.Date(DATE, %d/%m/%Y)  # to tell R that DATE column is indeed dates
with(DF, plot(DATE,pH))
 
Until here it works fine, but I have the graph plotting only the points. What I 
want is to have a line (join these points) so to have a time plot. I have tried 
different commands such as lines(DATE,pH) or with(DF, lines(DATE,pH) but 
nothing works. 
 
What can I do?
 
Yours
Lathouri Maria

[[alternative HTML version deleted]]

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


Re: [R] Time plots

2008-11-17 Thread jim holtman
try

plot(DATE, pH, type='l')

On Mon, Nov 17, 2008 at 10:30 AM, Lathouri, Maria
[EMAIL PROTECTED] wrote:
 Dear all,
 I want to do some time plots and actually the dates are in the format of 
 dd/mm/. So first I input my dataframe in R in a csv form. What I do is

 DF-read.csv(C:/Documents and Settings/DF.csv)
 DATE-as.Date(DATE, %d/%m/%Y)  # to tell R that DATE column is indeed dates
 with(DF, plot(DATE,pH))

 Until here it works fine, but I have the graph plotting only the points. What 
 I want is to have a line (join these points) so to have a time plot. I have 
 tried different commands such as lines(DATE,pH) or with(DF, lines(DATE,pH) 
 but nothing works.

 What can I do?

 Yours
 Lathouri Maria

[[alternative HTML version deleted]]

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




-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem that you are trying to solve?

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


Re: [R] Time plots

2008-11-17 Thread Stefan Grosse
On Mon, 17 Nov 2008 15:30:14 - Lathouri, Maria
[EMAIL PROTECTED] wrote:

LM I want to do some time plots and actually the dates are in the
LM format of dd/mm/. So first I input my dataframe in R in a csv
LM form. What I do is DF-read.csv(C:/Documents and Settings/DF.csv)
LM DATE-as.Date(DATE, %d/%m/%Y)  # to tell R that DATE column is
LM indeed dates with(DF, plot(DATE,pH))

Use a time series class for your data. Then you will get plots with
lines. Have a look at the zoo package and/or ?ts

Stefan

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


Re: [R] Time plots

2008-11-17 Thread Gabor Grothendieck
Also if this is a time series you may wish to represent it as such
to facilitate other computations as well.  This assumes that the
DATE column is first and the remaining columns are numeric:

library(zoo)
mypath - /whatever/myfile.csv
z - read.zoo(mypath, sep = ,, header = TRUE, format = %d/%m/%Y)
plot(z)

See the three zoo vignettes for more info.


On Mon, Nov 17, 2008 at 11:00 AM, jim holtman [EMAIL PROTECTED] wrote:
 try

 plot(DATE, pH, type='l')

 On Mon, Nov 17, 2008 at 10:30 AM, Lathouri, Maria
 [EMAIL PROTECTED] wrote:
 Dear all,
 I want to do some time plots and actually the dates are in the format of 
 dd/mm/. So first I input my dataframe in R in a csv form. What I do is

 DF-read.csv(C:/Documents and Settings/DF.csv)
 DATE-as.Date(DATE, %d/%m/%Y)  # to tell R that DATE column is indeed dates
 with(DF, plot(DATE,pH))

 Until here it works fine, but I have the graph plotting only the points. 
 What I want is to have a line (join these points) so to have a time plot. I 
 have tried different commands such as lines(DATE,pH) or with(DF, 
 lines(DATE,pH) but nothing works.

 What can I do?

 Yours
 Lathouri Maria

[[alternative HTML version deleted]]

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




 --
 Jim Holtman
 Cincinnati, OH
 +1 513 646 9390

 What is the problem that you are trying to solve?

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


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


Re: [R] Time plots

2008-11-17 Thread Oliver Bandel
Lathouri, Maria m.lathouri06 at imperial.ac.uk writes:

[...]
 Until here it works fine, but I have the graph plotting only the points. What
I want is to have a line (join
 these points) so to have a time plot. I have tried different commands such as
lines(DATE,pH) or with(DF,
 lines(DATE,pH) but nothing works. 
 
 What can I do?
[...]


plot(DATE,pH, type=l)

This should do it.

when you look into the plot-help-pages,
then you can see a lot of plotting-types.

with type p it plots points (default)
with type l it plots lines
with type b it plots lines and points

Ciao,
   Oliver

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