[R] problem converting character to dates

Assu assu.senra at gmail.com
Thu May 12 17:40:07 CEST 2011


Hi all,

I've searched this problem and still I can't understand my results, so here
goes:

I have some time series I've imported from excel with the dates in text
format from excel. Data was imported with RODBC, sqlQuery() function.

I have these dates: 
>adates
 [1] "01/2008" "02/2008" "03/2008" "04/2008" "05/2008" "06/2008" "07/2008"
  [8] "08/2008" "09/2008" "10/2008" "11/2008" "12/2008" "13/2008" "14/2008"
I want the format week/year, so I do:
>as.Date(adates,format=c("%W/%y"))
and get 
 [1] "2020-05-12" "2020-05-12" "2020-05-12" "2020-05-12" "2020-05-12"
  [6] "2020-05-12" "2020-05-12" "2020-05-12" "2020-05-12" "2020-05-12"
everything is equal to this: 2020-this month-today

if I use  strptime(dates, "%W/%y")
it's the same.

Can you explain why this happens and how to solve it?
Thanks in advance
Assu

--
View this message in context: http://r.789695.n4.nabble.com/problem-converting-character-to-dates-tp3517918p3517918.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list