I have R code that takes raw data where each patient entry is one row, and sums it up for a ‘frequency’ column for each department by date.
What I used here was the code:
department_totals <- as.data.frame(count(sheet, c("Date", "Department")))
But for this new project, I need it to be the actual individual departments by date, like this:
And I can’t figure out how to do it. I can group by department, but I’m trying to make each unique variable in ‘Department’ its own variable and then have the frequency of variables for each of those as a new column, ordered by date.
The intent here is to be able to make line graphs of how each of these departments’ frequency of patients changes over time.
Leave an answer