[R] Conversion from string to date type

Andreas Tille tillea at rki.de
Fri Mar 23 22:21:15 CET 2007


Hi,

I'm on my very first steps to R and so I hope that I do
not ask a really stupid questions but I did not found it
via R-Search, in the FAQ or Google (BTW, the name "R" is
not a really good seekiong criterion ;-) ).

I have a data file containing a table that containes
dates and values like

date\t value1\t value2, ...
01.03.2007\t 17\t 42\t ...
02.03.2007\t 2\t 3\t ...
03.03.2007\t 47\t 11\t ...
...

I was perfectly able to read this file via

mydata <- read.csv(file='mydata.dat', sep = '\t', quote='', fill=TRUE,header=TRUE )

but the date vector is a vector of strings instead of date values.
I want to convert these strings into date values to be able
to make graphs where date is the x-axis and value? the y-axis.

I would be really happy if someone could enlighten me how to
do this conversion (and a hint how to do a graph as PNG) would
be an extra bonus which would shorten my further reading of the
docs).

Kind regards and thanks for your help

           Andreas.

-- 
http://fam-tille.de



More information about the R-help mailing list