Grouping TV Episodes by Identifier: A Base R Alternative to Timeplyr
The function time_episodes() is a wrapper around the episodes() function from the timeplyr package. It groups the data by identifier, sorts the data by date within each group, and then identifies episodes of length at least 28 days or starting on the first row in each group.
Alternatively, you can achieve the same result using base R code with the group_by(), arrange(), mutate(), and row_number() functions.
Last modified on 2024-07-02