By reproducing the example data frame and testing it I found a way of getting the needed result:
-
Order data by relevant columns (ID, Start)
ordered_data <- data[order(data$ID, data$Start),]
-
Find the first row for each new ID
final <- ordered_data[!duplicated(ordered_data$ID),]
More Related Contents:
- Faster ways to calculate frequencies and cast from long to wide
- Group by multiple columns and sum other multiple columns
- Aggregate a dataframe on a given column and display another column
- Aggregate a data frame based on unordered pairs of columns
- Get the means of sub groups of means in R
- R use ddply or aggregate
- How to sum a variable by group
- Collapse / concatenate / aggregate a column to a single comma separated string within each group
- Reshape three column data frame to matrix (“long” to “wide” format) [duplicate]
- Count number of rows per group and add result to original data frame
- Why does summarize or mutate not work with group_by when I load `plyr` after `dplyr`?
- Apply several summary functions on several variables by group in one call
- Summarizing multiple columns with dplyr? [duplicate]
- Extract the maximum value within each group in a dataframe [duplicate]
- How to create a lag variable within each group?
- Why are my dplyr group_by & summarize not working properly? (name-collision with plyr)
- Apply function conditionally
- Unique rows, considering two columns, in R, without order
- Summarizing by subgroup percentage in R
- Collapsing rows where some are all NA, others are disjoint with some NAs
- dplyr summarise: Equivalent of “.drop=FALSE” to keep groups with zero length in output
- dplyr: “Error in n(): function should not be called directly”
- Change value of variable with dplyr
- Aggregate and reshape from long to wide
- R sum a variable by two groups [duplicate]
- Combining duplicated rows in R and adding new column containing IDs of duplicates
- ddply for sum by group in R
- Run a custom function on a data frame in R, by group
- R – Faster Way to Calculate Rolling Statistics Over a Variable Interval
- Aggregating all unique values of each column of data frame