0

I have a large data set with over thousands of date, with 5 diffenrent date types formats ("%d/%m/%y", "yyyy-mm-dd", "44312"(for exemple), "275501" (for exemple), and the last format "mm/dd/yyyy").

How can I change into a single date format ? I would like to keep this date format ;

"2021-04-01"

dput(head(data.na))

structure(list(date = c("29/03/21", "29/03/21", "29/03/21", "29/03/21", 
"29/03/21", "29/03/21"), id = c("usr012", "usr012", "usr012", 
"usr012", "usr015", "usr020"), product = c("Oignon frais - Botte de 300g 1 pièce", 
"Mâche - Poche de 200g 1 pièce", "Aillet - Botte de 200g 1 pièce", 
"Courge butternut - Petite pièce de 800g à 1,2kg environ", "Scarole 1 pièce", 
"Aillet Botte de 200g 1 pièce"), price = c(2, 2, 2, 3, 1.1, 2
), quantity = c(1, 1, 1, 0.77, 1, 1), total = c(2, 2, 2, 2.31, 
1.1, 2)), row.names = c(NA, 6L), class = "data.frame")

enter image description here

enter image description here

enter image description here

enter image description here

  • Please do not post (only) an image of code/data/errors: it breaks screen-readers and it cannot be copied or searched (ref: https://meta.stackoverflow.com/a/285557 and https://xkcd.com/2116/). Please include the code, console output, or data (e.g., `data.frame(...)` or the output from `dput(head(x))`) directly. – r2evans May 02 '22 at 19:43
  • Also, you probably don't need to post the entire data frame. You can post just relevant portions of the `date` column (i.e., elements including all of the different formats you want to be able to handle). – Ben Bolker May 02 '22 at 19:55
  • I am new to rstudio, I don't know the software and even less stack overflow. Is there a way to send the file directly to you? – userR123456 May 02 '22 at 20:31

0 Answers0