0

I have a dataframe with a date column using a specific date pattern, where the format is "Sat Aug 15 1992", for example. I tried to use as.Date("Sat Aug 15 1992","%Y-%m-%d") but it returns only NA. How can I make R understand my column as a date?

Guilherme do Valle
  • 401
  • 1
  • 4
  • 17

2 Answers2

1

Try

as.Date("Sat Aug 15 1992",format="%Y-%m-%d")
noah1400
  • 1,282
  • 1
  • 4
  • 15
1

Check ?strptime, you can use :

as.Date("Sat Aug 15 1992","%a %b %d %Y")
#[1] "1992-08-15"
Ronak Shah
  • 377,200
  • 20
  • 156
  • 213