bcgov / bcgov/wqbench

Updating data set with new trophic groups will only add certain groupings.

Open
#59 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
R
Stars
3
Forks
2
PR merge metrics
No merged PRs in 30d

Description

When the trophic group table and species table is joined it is based on certain conditions.

There must be a match between the tables. In the trophic table missing values are set to be `NA` and not `""`, this ensure that the matches are correct ie they are not matching missing values.
- Phylum
- Class and phylum
- Order, class and phylum
- Family, order, class and phylum

```
# create the joins for each category
df_f <- dplyr::left_join(
db_species,
dplyr::filter(
trophic_groups,
!is.na(.data$family)
),
by = c("family", "tax_order" = "order", "class", "phylum_division")
)

df_o <- dplyr::left_join(
db_species,
dplyr::select(
dplyr::filter(
trophic_groups,
!is.na(.data$order) & is.na(.data$family)
),
-"family"
),
by = c("tax_order" = "order", "class", "phylum_division")
)

df_c <- dplyr::left_join(
db_species,
dplyr::select(
dplyr::filter(
trophic_groups,
!is.na(.data$class) & is.na(.data$family) & is.na(.data$order)
),
-"order", -"family"
),
by = c("class", "phylum_division")
)

df_p <- dplyr::left_join(
db_species,
dplyr::select(
dplyr::filter(
trophic_groups,
!is.na(.data$phylum_division) & is.na(.data$family) & is.na(.data$order) & is.na(.data$class)
),
-"family", -"order", -"class"
),
by = c("phylum_division")
)
```

Contributor guide

Open the contributing guide

Research direction

Start by locating the code that joins the trophic group table to the species table and review the four grouping joins shown in the issue. Check how NA values and the Phylum, Class, Order, and Family combinations are handled. Done means updating the data set includes all intended trophic groupings without matching missing values.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
data-engineering
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.