I am working on a table which has transaction records of a product in a store. Now I have to create a summary of transaction count by date. How can I do that?
Here's the code I am writing but it's not giving the desired output
transactions_by_date <- transaction_data %>%
group_by(transaction_data$DATE) %>%
summarise(count = n_distinct(transaction_data$DATE))
It's giving me a tibble of 364 x 2 of:
Date and total no. of distinct records in front of dates column like
2018-07-01 364
2018-07-02 364
2018-07-03 364
--and so on...
But I want total 364 records with date and no. of transactions made on that particular day
Hi @UpasanaSharma ,
Could you please provide a sample (made-up) dataset, which we could use to provide help?
Thank you.
UpasanaSharma:
transaction_data$DATE
This is not valid dplyr
syntax, I think you want to do something like this
library(dplyr)
transactions_by_date <- transaction_data %>%
count(DATE, name = "count")
If you need more specific help, please provide a proper REPR oducible EX ample (reprex) illustrating your issue.
I solved it, but thanks for the suggestion.
And how did you solve it?
system
Closed
April 4, 2022, 4:29pm
7
This topic was automatically closed 21 days after the last reply. New replies are no longer allowed. If you have a query related to it or one of the replies, start a new topic and refer back with a link.