Re: [R] How to convert European short dates to ISO format?

2020-06-11 Thread Luigi Marongiu
Thank you. It worked. Case closed On Thu, 11 Jun 2020, 16:48 Rasmus Liland, wrote: > On 2020-06-10 10:20 +0200, Luigi Marongiu wrote: > > I have been trying to convert European > > short dates formatted as dd/mm/yy into the > > ISO 8601 but the function as.Dates > > interprets them as American o

Re: [R] How to convert European short dates to ISO format?

2020-06-11 Thread Rasmus Liland
On 2020-06-10 10:20 +0200, Luigi Marongiu wrote: > I have been trying to convert European > short dates formatted as dd/mm/yy into the > ISO 8601 but the function as.Dates > interprets them as American ones > (mm/dd/yy) Dear Luigi, ?strptime says: ā€˜%Dā€™ Date format such as ā€˜%m/%d/%yā€™:

Re: [R] How to convert European short dates to ISO format?

2020-06-11 Thread Martin Maechler
> Rich Shepard > on Thu, 11 Jun 2020 06:29:13 -0700 writes: > On Thu, 11 Jun 2020, Martin Maechler wrote: >> > Look at Hadley Wickham's 'tidyverse' collection as > >> described in R for Data Science. There are date, >> datetime, > and time functions that will do just w

Re: [R] How to convert European short dates to ISO format?

2020-06-11 Thread Rich Shepard
On Thu, 11 Jun 2020, Martin Maechler wrote: > Look at Hadley Wickham's 'tidyverse' collection as > described in R for Data Science. There are date, datetime, > and time functions that will do just what you want. I strongly disagree that automatic guessing of date format is a good ide

Re: [R] How to convert European short dates to ISO format?

2020-06-11 Thread Rich Shepard
On Thu, 11 Jun 2020, Richard O'Keefe wrote: I would add to this that in an important data set I was working with, most of the dates were dd/mm/yy but some of them were mm/dd/yy and that led to the realisation that I couldn't *tell* for about 40% of the dates which they were. If they were all one

Re: [R] How to convert European short dates to ISO format?

2020-06-11 Thread Richard O'Keefe
I would add to this that in an important data set I was working with, most of the dates were dd/mm/yy but some of them were mm/dd/yy and that led to the realisation that I couldn't *tell* for about 40% of the dates which they were. If they were all one or the other, no worries, but when you have p

Re: [R] How to convert European short dates to ISO format?

2020-06-11 Thread Martin Maechler
> Rich Shepard > on Wed, 10 Jun 2020 07:44:49 -0700 writes: > On Wed, 10 Jun 2020, Jeff Newmiller wrote: >> Fix your format specification? ?strptime >>> I have been trying to convert European short dates >>> formatted as dd/mm/yy into the ISO 8601 but the function

Re: [R] How to convert European short dates to ISO format?

2020-06-10 Thread Rich Shepard
On Wed, 10 Jun 2020, Jeff Newmiller wrote: Fix your format specification? ?strptime I have been trying to convert European short dates formatted as dd/mm/yy into the ISO 8601 but the function as.Dates interprets them as American ones (mm/dd/yy), thus I get: Look at Hadley Wickham's 'tidyver

Re: [R] How to convert European short dates to ISO format?

2020-06-10 Thread Jeff Newmiller
Fix your format specification? ?strptime On June 10, 2020 1:20:01 AM PDT, Luigi Marongiu wrote: >Hello, >I have been trying to convert European short dates formatted as >dd/mm/yy into the ISO 8601 but the function as.Dates interprets them >as American ones (mm/dd/yy), thus I get: > >``` >oriDat

Re: [R] How to convert European short dates to ISO format?

2020-06-10 Thread Heinz Tuechler
maybe isoDates <- as.Date(oriDates, format = "%d/%m/%y") Heinz Luigi Marongiu wrote/hat geschrieben on/am 10.06.2020 10:20: Hello, I have been trying to convert European short dates formatted as dd/mm/yy into the ISO 8601 but the function as.Dates interprets them as American ones (mm/dd/yy), th

Re: [R] How to convert European short dates to ISO format?

2020-06-10 Thread Berend Hasselman
Luigi, Try format = "%d/%m/%y" Berend Hasselman > On 10 Jun 2020, at 10:20, Luigi Marongiu wrote: > > ISO 8601 __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the post

Re: [R] How to convert European short dates to ISO format?

2020-06-10 Thread Luigi Marongiu
Thank you! On Wed, Jun 10, 2020 at 10:29 AM Daniel Nordlund wrote: > > On 6/10/2020 1:20 AM, Luigi Marongiu wrote: > > isoDates = as.Date(oriDates, format = "%m/%d/%y") > > You need to use the format for European short dates. > > isoDates = as.Date(oriDates, format = "%d/%m/%y") > > > Hope this i

Re: [R] How to convert European short dates to ISO format?

2020-06-10 Thread Kimmo Elo
Hi! Should it be: as.Date(oriDates, format="%d/%m/%y") # See the order of %d and %m!! This command seems to work for me, here the output: [1] "2020-01-23" "2020-01-24" "2020-01-25" "2020-01-26" "2020-01-27" "2020-01-28" "2020-01-29" "2020-01-30" [9] "2020-01-31" "2020-02-01" "2020-02-02" "202

Re: [R] How to convert European short dates to ISO format?

2020-06-10 Thread Daniel Nordlund
On 6/10/2020 1:20 AM, Luigi Marongiu wrote: isoDates = as.Date(oriDates, format = "%m/%d/%y") You need to use the format for European short dates. isoDates = as.Date(oriDates, format = "%d/%m/%y") Hope this is helpful, Dan -- Daniel Nordlund Port Townsend, WA USA

Re: [R] How to convert European short dates to ISO format?

2020-06-10 Thread Ivan Krylov
On Wed, 10 Jun 2020 10:20:01 +0200 Luigi Marongiu wrote: > the function as.Dates interprets them as American ones (mm/dd/yy) > isoDates = as.Date(oriDates, format = "%m/%d/%y") > How can I convert properly? Pass the correct format? (Swap m and d in the format string.) -- Best regards, Ivan

[R] How to convert European short dates to ISO format?

2020-06-10 Thread Luigi Marongiu
Hello, I have been trying to convert European short dates formatted as dd/mm/yy into the ISO 8601 but the function as.Dates interprets them as American ones (mm/dd/yy), thus I get: ``` oriDates = c("23/01/20", "24/01/20", "25/01/20", "26/01/20", "27/01/20", "28/01/20", "29/01/20", "30/01/20",