-2

I'm trying to convert the date to something like DAY1, DAY2, DAY3, instead of normal Monday, Tuesday, Wednesday.

rbind(DWReport__04,DWReport__05,DWReport__06,
          DWReport__07,DWReport__08,DWReport__09,
          DWReport__10,DWReport__11,DWReport__12,
          DWReport__13) %>%
           mutate( DAY = day(as.Date(Date, "%d/%m/%Y")))

can anyone help with adjustment on the code ?

Ronak Shah
  • 377,200
  • 20
  • 156
  • 213
  • 1
    Hi.. Welcome to StackOverflow, please use this [link](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) to understand how to ask your questions, so it'll be possible for us to understand and answer. – Mohan Govindasamy Feb 16 '21 at 08:55
  • Your code does not give Monday, Tuesday, Wednesday. `day` just returns a number back. It would be easier to help if you create a small reproducible example along with expected output. Read about [how to give a reproducible example](http://stackoverflow.com/questions/5963269). – Ronak Shah Feb 16 '21 at 09:08
  • Thank you @Ronak.......what i want is to create a column that will group all transaction by date example of date dataset Date 15/02/2021 23:59 15/02/2021 23:56 15/02/2021 23:54 14/02/2021 23:54 14/02/2021 23:54 14/02/2021 23:54 14/02/2021 23:54 14/02/2021 23:54 14/02/2021 23:54 14/02/2021 23:54 13/02/2021 23:46 13/02/2021 23:46 13/02/2021 23:46 13/02/2021 23:46 13/02/2021 23:46 15/02/2021 23:40 15/02/2021 23:40 all transactions that fall under 13/02/2021 should be grouped as DAY1 14/02/2021 as DAY2 and so on ... Thanks for the headup – Oriyomi Alaba Feb 16 '21 at 09:45
  • 1
    See answer proposed on your similar question – AnilGoyal Feb 16 '21 at 10:08

1 Answers1

0

I think you've done the hard bit already.

Where you have mutate( DAY = day(as.Date(Date, "%d/%m/%Y")))

I believe you could just use: mutate(DAY = paste0("DAY", day(as.Date(Date, "%d/%m/%Y"))))

gladys_c_hugh
  • 158
  • 1
  • 9