Hello, Andreas

I'm glad the previous replies helped you solve your problem.
I think your original problem, though,
was caused by a typo.  Note
the comma between the month and the year in your script and 
the
period between the month and the year in Jim Holtman's 
script.

>From Jim Holtman:

> 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

>From Andreas Tillea:
>Well, this is what I tried when reading the docs, but

> mydata <- read.csv(file='mydata.dat', sep = '\t', 
> quote='', fill=TRUE,header=TRUE )
> datum <- as.Date(mydata["date"], "%d.%m,%y")
>Error in as.Date.default(mydata["date"], "%d.%m,%y") :
         do not know how to convert 'mydata["date"]' to 
class "Date"

>I also tried:

> datum <- strptime(imydata["date"], "%d.%m,%y")
> datum
>[1] NA
Hope this helps for the future

Toby

Toby Gass
Department of Forest, Rangeland, and Watershed Stewardship
Warner College of Natural Resources
Colorado State University
Fort Collins, CO  80523

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

Reply via email to