Skip to content

Error matching partially overlapping codes in load_rec --> extract_prm --> scan_prm #38

Description

@lyperng

In Atlantis MHI (Main Hawaiian Islands), we have an MS group code and an MSL group code.

When running:
ssb_rec <- load_rec(yoy = yoy, ssb = ssb, prm_biol = prm_biol)

I received this error:
Error in FUN(X[[i]], ...) : Variable KWRR_MS found multiple times.

Which I traced back to the scan_prm function which is called in the extract_prm function, which is called in the load_rec function.

In scan_prm, the first line:
pos <- grep(pattern = variable, x = chars)

matches the string 'MS' to both MS and MSL.

The workaround I applied was:
pos <- grep(pattern = paste0(variable,' '), x = chars)

which will search for 'MS ' with a space attached to the end, and thus not match MSL.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugUnexpected or undesirable behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions