To divide one row of a data frame by another row if the next column matches in R, you can use the dplyr package from the tidyverse suite. Here is an example of how you can divide rows in a data frame by the rows matching the next column:
main.r405 chars14 lines
In this example, we first group the data frame by the Group column. Then, we calculate the ratio of the Value1 column of rows where Value2 is the maximum and minimum within each group. Finally, we ungroup the data frame to get the final result.
gistlibby LogSnag