Here is how you can convert them to a Date object:

> x <- c('01.03.2007','02.03.2007','03.03.2007')
> y <- as.Date(x, format="%d.%m.%Y")
> y
[1] "2007-03-01" "2007-03-02" "2007-03-03"
> str(y)
Class 'Date'  num [1:3] 13573 13574 13575
>



On 3/23/07, Andreas Tille <tillea@rki.de> wrote:
>
> 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
>
> ______________________________________________
> R-help@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.
>



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

What is the problem you are trying to solve?

	[[alternative HTML version deleted]]

