mhpob / pier-seine

0 stars 1 forks source link

Adjust scientific names #2

Open mhpob opened 3 years ago

mhpob commented 3 years ago

A few scientific names got left behind in #1:

And possible to figure out which species the blanks (lengths$scientific == "") belong to?

flyfrey commented 3 years ago

Gotcha, good catch. Been fiddling with a better approach to editing names.

mhpob commented 3 years ago

They're tough to sort out in any type of efficient way. A nested ifelse() could help:

lengths[, lengths := ifelse(lengths == 'fundulus heterclitus', 'fundulus heteroclitus',
                                          ifelse(lengths == 'hypsoblennius hentz ', 'hypsoblennius hentz', lengths))]

dplyr::case_when is probably the easiest, though. data.table::fcase requires you to list all of the different options. case_when doesn't.