Skip to content

Fix "undefined" gear type in dashboard #11

@kelvin-kiplagat

Description

@kelvin-kiplagat

We need to add nets for it to be evaluated in case_when() for the nets gear type because it is among the gears in the Aina_ya_zana_ya_uvuvi column. Alternatively we can let TRUE evaluate to gear as in TRUE ~ gear instead of TRUE ~ NA_character_ so that if we missed any gear type in the broad categorization, it can fall to the gear type in the data.

I would prefer Option 2 unless you have any special reservations why Option 1 is better. The advantage of Option 1 is the ease of identifying gear types from the data that are off. The advantage of Option 2 is that we will always have a gear types shown in the dashboard no matter the circumstance.

Option 1

...
        gear = dplyr::case_when(
          .data$gear %in%
            c(
              "setnet",
              ...,
              "nyavu",
              ...,
              "nets"
            ) ~
            "Nets",
...

Option 2

...
    dplyr::mutate(
        gear = dplyr::case_when(
          .data$gear %in%
            c(
              "setnet",
              ...,
              "trammel_net"
            ) ~
            "Nets",
          .data$gear %in% c("handline") ~ "Handline",
          ...,
          .data$gear == "handline" ~ "Handline",
          TRUE ~ gear #This will fall back into gear type in the data
        )
...

Note: We intend to expand the nets categories in the future instead of lumping them altogether - will advise on that.

The issue was raised here

Kelvin

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions