Skip to content

The logic behind match.arg() is lost in this if else statement #9

@kellijohnson-NOAA

Description

@kellijohnson-NOAA

https://github.com/nmfs-ost/satf/blob/1641eba94dc762663725213503d450f984bec846/R/plot_spawning_biomass.R#L30-L34
should be

ref_line <- match.arg(ref_line)

the first entry of the default values in the function argument is always used used as the default when a user does not specify anything. There is no need for the complications of the if statement or the use of several.ok = FALSE because that is the default behavior of match.arg().
See the below example of calling optim in R where they also use match.arg()
image

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