ripley at stats.ox.ac.uk
2008-Sep-10 21:05 UTC
[Rd] (PR#12770) format() under Windows giv wrong resuts with
On Windows XP SP3> format(pippo, format="%I:%M:%S %p")[1] "11:43:12 PM" In any case, if there is a problem it is in Windows, not in R, since this is an Windows service that is being called. So there is no evidence at all of any bug in R here. On Wed, 10 Sep 2008, pego.enrico at tiscali.it wrote:> Full_Name: Enrico Pegoraro > Version: 2.7.2 > OS: Windows > Submission from: (NULL) (87.4.187.101) > > > The > format(timevar,format="%I:%M:%S %p") > instruction, with "timevar" a "POSIXt" "POSIXlt" variable, give wrong return > data. > The format sentence string "%I:%M:%S %p" requires times with AM/PM indicator, > but the resulting output doesn't contain it. > Example: >> pippo=strptime("23:43:12", format="%H:%M:%S") >> pippo > [1] "2008-09-10 23:43:12" >> class(pippo) > [1] "POSIXt" "POSIXlt" >> format(pippo, format="%I:%M:%S %p") > [1] "11:43:12 " > > Note that in linux version of R format() works correctly. > Best regards > Enrico > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel >-- Brian D. Ripley, ripley at stats.ox.ac.uk 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
ripley at stats.ox.ac.uk
2008-Sep-10 21:20 UTC
[Rd] (PR#12770) format() under Windows giv wrong resuts with
On Wed, 10 Sep 2008, ripley at stats.ox.ac.uk wrote:> On Windows XP SP3 > >> format(pippo, format="%I:%M:%S %p") > [1] "11:43:12 PM" > > In any case, if there is a problem it is in Windows, not in R, since this > is an Windows service that is being called. So there is no evidence at > all of any bug in R here.Let me add that this might be a locale-specific issue: the locale was not given (despite being part of the 'at a minimum' information asked for in the posting guide). Note that the help page does say '%p' AM/PM indicator in the locale. Used in conjuction with '%I' ^^^^^^^^^^^^^ Not all locales have such an indicator (usually those that use a 24-hour clock).> On Wed, 10 Sep 2008, pego.enrico at tiscali.it wrote: > >> Full_Name: Enrico Pegoraro >> Version: 2.7.2 >> OS: Windows >> Submission from: (NULL) (87.4.187.101) >> >> >> The >> format(timevar,format="%I:%M:%S %p") >> instruction, with "timevar" a "POSIXt" "POSIXlt" variable, give wrong return >> data. >> The format sentence string "%I:%M:%S %p" requires times with AM/PM indicator, >> but the resulting output doesn't contain it. >> Example: >>> pippo=strptime("23:43:12", format="%H:%M:%S") >>> pippo >> [1] "2008-09-10 23:43:12" >>> class(pippo) >> [1] "POSIXt" "POSIXlt" >>> format(pippo, format="%I:%M:%S %p") >> [1] "11:43:12 " >> >> Note that in linux version of R format() works correctly. >> Best regards >> Enrico >> >> ______________________________________________ >> R-devel at r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-devel >> > > -- > Brian D. Ripley, ripley at stats.ox.ac.uk > 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 > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel >-- Brian D. Ripley, ripley at stats.ox.ac.uk 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
Bill Dunlap
2008-Sep-10 21:46 UTC
[Rd] (PR#12770) format() under Windows giv wrong resuts with
I can reproduce the problem on Windows XP service pack 3 with R 2.8.0-dev if I set the locale to "italian" (by default it is English_United States" for me): > pippo=strptime("23:43:12", format="%H:%M:%S") > format(pippo, format="%I:%M:%S %p") [1] "11:43:12 PM" > Sys.setlocale(loc="italian") [1] "LC_COLLATE=Italian_Italy.1252;LC_CTYPE=Italian_Italy.1252;LC_MONETARY=Italian_Italy.1252;LC_NUMERIC=C;LC_TIME=Italian_Italy.1252" > format(pippo, format="%I:%M:%S %p") [1] "11:43:12 " It does look like a Windows problem. On Wed, 10 Sep 2008 ripley at stats.ox.ac.uk wrote:> On Windows XP SP3 > > > format(pippo, format="%I:%M:%S %p") > [1] "11:43:12 PM" > > In any case, if there is a problem it is in Windows, not in R, since this > is an Windows service that is being called. So there is no evidence at > all of any bug in R here. > > On Wed, 10 Sep 2008, pego.enrico at tiscali.it wrote: > > > Full_Name: Enrico Pegoraro > > Version: 2.7.2 > > OS: Windows > > Submission from: (NULL) (87.4.187.101) > > > > > > The > > format(timevar,format="%I:%M:%S %p") > > instruction, with "timevar" a "POSIXt" "POSIXlt" variable, give wrong return > > data. > > The format sentence string "%I:%M:%S %p" requires times with AM/PM indicator, > > but the resulting output doesn't contain it. > > Example: > >> pippo=strptime("23:43:12", format="%H:%M:%S") > >> pippo > > [1] "2008-09-10 23:43:12" > >> class(pippo) > > [1] "POSIXt" "POSIXlt" > >> format(pippo, format="%I:%M:%S %p") > > [1] "11:43:12 " > > > > Note that in linux version of R format() works correctly. > > Best regards > > Enrico > ... signatures ...---------------------------------------------------------------------------- Bill Dunlap TIBCO Spotfire wdunlap tibco.com "All statements in this message represent the opinions of the author and do not necessarily reflect TIBCO Software Inc. policy or position."
ripley at stats.ox.ac.uk
2008-Sep-11 07:30 UTC
[Rd] (PR#12770) format() under Windows giv wrong resuts with
On Wed, 10 Sep 2008, Bill Dunlap wrote:> I can reproduce the problem on Windows XP service pack 3 > with R 2.8.0-dev if I set the locale to "italian" (by default > it is English_United States" for me): > > pippo=strptime("23:43:12", format="%H:%M:%S") > > format(pippo, format="%I:%M:%S %p") > [1] "11:43:12 PM" > > Sys.setlocale(loc="italian") > [1] "LC_COLLATE=Italian_Italy.1252;LC_CTYPE=Italian_Italy.1252;LC_MONETARY=Italian_Italy.1252;LC_NUMERIC=C;LC_TIME=Italian_Italy.1252" > > format(pippo, format="%I:%M:%S %p") > [1] "11:43:12 " > It does look like a Windows problem.Or a deliberate locale definition on Windows. The R help does say Locale-specific conversions to and from character strings are used where appropriate and available. This affects the names of the days and months, the AM/PM indicator (if used) and the separators in formats such as '%x' and '%X'. and AFAICS none is used in the Italian locale on Windows XP. (POSIX does not say that this is allowed to be empty, but it also does not say that it not allowed.)> > On Wed, 10 Sep 2008 ripley at stats.ox.ac.uk wrote: > >> On Windows XP SP3 >> >>> format(pippo, format="%I:%M:%S %p") >> [1] "11:43:12 PM" >> >> In any case, if there is a problem it is in Windows, not in R, since this >> is an Windows service that is being called. So there is no evidence at >> all of any bug in R here. >> >> On Wed, 10 Sep 2008, pego.enrico at tiscali.it wrote: >> >>> Full_Name: Enrico Pegoraro >>> Version: 2.7.2 >>> OS: Windows >>> Submission from: (NULL) (87.4.187.101) >>> >>> >>> The >>> format(timevar,format="%I:%M:%S %p") >>> instruction, with "timevar" a "POSIXt" "POSIXlt" variable, give wrong return >>> data. >>> The format sentence string "%I:%M:%S %p" requires times with AM/PM indicator, >>> but the resulting output doesn't contain it. >>> Example: >>>> pippo=strptime("23:43:12", format="%H:%M:%S") >>>> pippo >>> [1] "2008-09-10 23:43:12" >>>> class(pippo) >>> [1] "POSIXt" "POSIXlt" >>>> format(pippo, format="%I:%M:%S %p") >>> [1] "11:43:12 " >>> >>> Note that in linux version of R format() works correctly. >>> Best regards >>> Enrico >> ... signatures ... > > ---------------------------------------------------------------------------- > Bill Dunlap > TIBCO Spotfire > wdunlap tibco.com > > "All statements in this message represent the opinions of the author and do > not necessarily reflect TIBCO Software Inc. policy or position." >-- Brian D. Ripley, ripley at stats.ox.ac.uk 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