0

I have a dataset of 2015 with every day of the year. In this dataset, there are actions that happen on any given day. Some days have more actions than others, therefore some days have many more entries than others.

I am trying to create a function that will create an individual dataset per day of the year without having to code 365 of these:

df <- subset(dataset, date== "2015-01-01")

I have looked at dyplyr's group_by(), however I do not want a summary per day, it is important that I get to see the whole observation on any given day for graphing purposes.

Buckethead
  • 31
  • 4
  • 1
    You may use `split(dataset, dataset$date)` or use `dataset %>% group_by(date) %>% ...` – akrun Jan 13 '23 at 21:37
  • I think akrun's suggested `split` is a good start, as it will give you a [list of frames](https://stackoverflow.com/a/24376207/3358227) where you can then do `spl[["2015-01-01"]]` to retrieve that one frame. _However_, often there is a better way to do it for data-management, depending on what you need in the end. Perhaps you can state what you are doing for each "day" of data and what you ultimately need after processing? – r2evans Jan 13 '23 at 21:40
  • I will graph the actions that happen every day individually on a map using ggplot/ggmap. I want to show the daily actions on these grids but that is the trick, every single graphing must be daily. – Buckethead Jan 13 '23 at 21:51
  • Okay, then the `split` trick might be best for now. – r2evans Jan 13 '23 at 22:09

0 Answers0