I have a data frame with dates in the format of yyyy-mm-dd hh:mm:ss
.
I want to count the total values in each row that are later than 2021-05-22 00:00:00
, exclude the ID
and creation_date
column, and add a new column date_count
with the count.
This is the data frame I have:
ID creation_date date1 date2 date230
1 2021-03-04 06:40:37 2021-03... 2022-06... 2022-06
2 2021-03-05 04:24:43 2021-04... NA NA
3 2022-03-19 20:37:07 2022-05... 2022-06... NA
...
563 2022-04-23 20:59:45 2022-05... 2022-05... 2022-06
This is the desired result:
ID creation_date date1 date2 date230 date_count
1 2021-03-04 06:40:37 2021-03... 2022-06... 2022-06... 123
2 2021-03-05 04:24:43 2021-04... NA NA 123
3 2022-03-19 20:37:07 2022-05... 2022-06... NA 123
...
563 2022-04-23 20:59:45 2022-05... 2022-05... 2022-06... 123
Any help would be appreciated. Thank you!