Re: [R] Conversion from string to date type

2007-03-24 Thread Toby Gass
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:

[R] Conversion from string to date type

2007-03-23 Thread Andreas Tille
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

Re: [R] Conversion from string to date type

2007-03-23 Thread 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 [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 [EMAIL PROTECTED] wrote: Hi, I'm on my

Re: [R] Conversion from string to date type

2007-03-23 Thread Andreas Tille
On Fri, 23 Mar 2007, jim holtman wrote: 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 Well, this is what I tried when reading the docs, but mydata - read.csv(file='mydata.dat', sep = '\t', quote='',

Re: [R] Conversion from string to date type

2007-03-23 Thread Gabor Grothendieck
Read the help desk article in R-News 4/1 and see ?as.Date ?strptime (for setting the as.Date format= argument) Also, you might be interested in the zoo package library(zoo) ?read.zoo vignette(zoo) vignette(zoo-quickref) On 3/23/07, Andreas Tille [EMAIL PROTECTED] wrote: Hi, I'm on my very

Re: [R] Conversion from string to date type

2007-03-23 Thread Dirk Eddelbuettel
Hi Andreas, Welcome to r-help :) On 23 March 2007 at 22:21, Andreas Tille wrote: | 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

Re: [R] Conversion from string to date type

2007-03-23 Thread Andreas Tille
On Fri, 23 Mar 2007, Dirk Eddelbuettel wrote: Nit 1: read.csv() is for csv files which tend to have , as a separator; read.table() is more useful here. Well, that's correct. read.csv was just a leftover from former tests and finally it worked also this way - but thanks for the hint anyway.