Skip to content

Find maximum value from groups of values #89

Description

@jaseeverett

We regularly cross two datasets and there will be multiple coverage or probabilities for a given PU and we need to select the highest one. We have used this code in the Med and in the Coral Triangle.

  dplyr::group_by(cellID) %>%
  dplyr::mutate(eez = eez[which.max(eez_pres)],
                eez_prop = eez_pres[which.max(eez_pres)]) %>%
  ungroup %>%
  dplyr::select(cellID, eez) %>%
  distinct()

Possibly create a splnr_ function from this.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions