Thank you very much for your answer, the suggested locale change solved
the problem.
 
/Per

<-----Original Message----->

                 From: Prof Brian Ripley
Sent: 9/3/2004 3:35:41 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED];[EMAIL PROTECTED]
Subject: Re: [R] strptime problems 

I suspect rather a locale problem which Date and chron will also have. 

You are looking for an abbreviated month name (%b). What language is the
object ccc in? What language is your computer in? See the example in 
?strptime 

## read in date info in format 'ddmmmyyyy' 
## This will give NA(s) in some locales; setting the C locale 
## as in the commented lines will overcome this on most systems. 
## lct <- Sys.getlocale("LC_TIME"); Sys.setlocale("LC_TIME", "C") 
x <- c("1jan1960", "2jan1960", "31mar1960", "30jul1960") 
z <- strptime(x, "%d%b%Y") 

Looking for English abbreviations in a Norwegian file, for example, will
not work and give NAs. 

On Fri, 3 Sep 2004, Thomas Petzoldt wrote: 

> Per Wiklund wrote: 
> 
> > 
> > Hi, I'm experiencing a problem with strptime. (R 1.9.1 on a Win2000 
> > machine) 
> 
> [...] 
> 
> > strptime(as.character(ccc[[11]]$TradeDateTime[161522]), 
> > "%d-%b-%y:%H:%M:%S") 
> > [1] NA 
> 
> [...] 
> 
> Hello, 
> 
> unfortunately, your code does not show what data are in the object
ccc, 
> so an exact diagnosis is almost impossible. However, I suspect you
have 
> timezone problems which are common on Windows computers. If you don't 
> need timezone calculations I suggest to use the Date class (uppercase 
> "D") or the chron package instead of the POSIX classes, see the last 
> issue of R-News: 
> 
> http://cran.r-project.org/doc/Rnews/Rnews_2004-1.pdf 
> 
> Thomas P. 

-- 
Brian D. Ripley, [EMAIL PROTECTED] 
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ 
University of Oxford, Tel: +44 1865 272861 (self) 
1 South Parks Road, +44 1865 272866 (PA) 
Oxford OX1 3TG, UK Fax: +44 1865 272595 

. 
        

        [[alternative HTML version deleted]]

______________________________________________
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to