-3

Im trying to convert a Date column in a csv file to a new column Day using R. Day in terms of Monday Tuesday etc. Apparently yday gives day of the year. Any solution?

Ali
  • 33
  • 6

1 Answers1

1

You could use the format function with %a or %A

date <- as.Date("2017-05-20")
format(date, "%A")
[1] "Saturday"
format(date, "%a")
[1] "Sat"

If your original date is in the format "07/29/05" in the column A$Date you can call

strDays <- format(as.Date(A$Date, "%m/%d/%y"), "%A")
Harald Gliebe
  • 7,236
  • 3
  • 33
  • 38