Re: [R] strptime, date and conversion of week number into POSIX

2021-02-22 Thread PIKAL Petr
ges ; R mailing list project.org>; Bert Gunter > Subject: Re: [R] strptime, date and conversion of week number into POSIX > > Thanks Uwe and Bert, > I got the essential now, and can manage. Date handling stays quite a > challenge with a variable number of weeks in a year, but

Re: [R] strptime, date and conversion of week number into POSIX

2021-02-22 Thread Uwe Ligges
That monday does not exist. FOr the week before: strptime(paste0("2020-52","-1"),format="%Y-%W-%u") [1] "2020-12-28" One week later is no longer in 2020, so there is no 53th week. Best, Uwe Ligges On 22.02.2021 16:15, Patrick Giraudoux wrote: Sorry to answer to myself, but the format was

Re: [R] strptime, date and conversion of week number into POSIX

2021-02-22 Thread Patrick Giraudoux
Thanks Uwe and  Bert, I got the essential now, and can manage. Date handling stays quite a challenge with a variable number of weeks in a year, but I can understand why. Means eye-control (or NA detection) of strptime conversion stays necessary... Best, Patrick Le 22/02/2021 à 17:09, Uwe Ligge

Re: [R] strptime, date and conversion of week number into POSIX

2021-02-22 Thread Bert Gunter
I think the relevant info from ?strptime is: "For strptime the input string need not specify the date completely: it is assumed that unspecified seconds, minutes or hours are zero, and an unspecified year, month or day is the current one. (However, if a month is specified, the day of that month ha

Re: [R] strptime, date and conversion of week number into POSIX

2021-02-22 Thread Patrick Giraudoux
Sorry to answer to myself, but the format was clearly incorrect in the previous post. It should read, refering to the 1th day of the week: strptime(paste0(mydate,"-1"),format="%Y-%W-%u") It converts better, but with a NA on week 53 > strptime(paste0(pays$year_week,"-1"),format="%Y-%W-%u") [1]