You could use strptime instead
dates <- c("27-Feb-92")
strptime(dates,"%d-%b-%y")

Jason


-----Original Message-----
From: [email protected] on behalf of Gabor Grothendieck
Sent: Sun 25/07/2010 9:34 AM
To: Peter Larson
Cc: [email protected]
Subject: Re: [R-sig-Geo] dates
 
On Sat, Jul 24, 2010 at 7:21 PM, Peter Larson <[email protected]> wrote:
> Hi,
>
> This is completely unrelated to spatial anything (well, ostensibly) but I am
> trying the following to convert a string to a date and am getting nothing"
>
> dates <- c("27-Feb-92")
> as.Date(dates,format= '%d-%b-%y')
> [1] NA
>
> Any ideas?
>
> Thanks and sorry for the off topic issue.
>

google for r-help to find the list for general questions.

At any rate this is just a guess, but it may be that you are working
in a non-English locale so that Feb is not the short form for
February.

Try this to find out what it thinks is Feb should be written as:

   format(as.Date("1992-02-27"), "%d-%b-%Y")

If this is the problem see help(Sys.setlocale)

_______________________________________________
R-sig-Geo mailing list
[email protected]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo


        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[email protected]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Reply via email to