Skip to content

Find maximum value from groups of values #89

@jaseeverett

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.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions