[R] out.format for chron

Denis Chabot chabotd at globetrotter.net
Thu Oct 19 17:01:16 CEST 2006


Got it Gabor,

Thank you very much.

Denis

Le 06-10-19 à 10:38, Gabor Grothendieck a écrit :

> For your second question:
>
> x <- chron(1)
> x <- chron(x, out.format = ddmmyyyy)
>
> using the ddmmyyyy from below.
>
> On 10/19/06, Gabor Grothendieck <ggrothendieck at gmail.com> wrote:
>> As discussed the Help Desk article in R News 4/1, the 2 vs 4 year
>> length is controlled by the chron.year.abb option,  e.g.
>>
>>   options(chron.year.abb = FALSE)
>>   chron(20)
>>
>> however, as also discussed there its not really recommended that
>> you use this option so try this instead:
>>
>>   ddmmyyyy <- function( x )
>>     with( month.day.year( x ), sprintf( "%02.f-%02.f-%04.f", day,
>> month, year) )
>>   chron( 20, out.format = ddmmyyyy )
>>
>>
>>
>>
>> On 10/19/06, Denis Chabot <chabotd at globetrotter.net> wrote:
>> > Dear R users,
>> >
>> > Do you know of a way to precise an out.format for a chron object  
>> that
>> > would use numbers for months and yet 4 digits for the year?
>> >
>> > I have tried out.format=c("d-m-year") (note the m instead of either
>> > mon or month) but got 27-Feb-1992.
>> >
>> > Also, the help for chron tells us how to define an out.format  
>> when we
>> > create a chron object, but how can you change the out.format of an
>> > existing chron object?
>> >
>> > Thanks in advance,
>> >
>> > Denis
>> >
>> > ______________________________________________
>> > R-help at stat.math.ethz.ch mailing list
>> > https://stat.ethz.ch/mailman/listinfo/r-help
>> > PLEASE do read the posting guide http://www.R-project.org/ 
>> posting-guide.html
>> > and provide commented, minimal, self-contained, reproducible code.
>> >
>>



More information about the R-help mailing list