brianstock / MixSIAR

A framework for Bayesian mixing models in R:
http://brianstock.github.io/MixSIAR/
91 stars 75 forks source link

small adjustment to code order and column selection in load_discr_data.R to make it more r… #389

Open EricBollingerResearch opened 1 month ago

EricBollingerResearch commented 1 month ago

Hi Brian,

first of all, thanks for all the effort and work you put in this package. I have a very small but (I hope) helpful suggestion.

If the CSV with discrimination data contains a non-numeric column, load_discr_data() breaks because it converts the data to a matrix without removing non-numeric columns. Especially for non-experienced users the generic "non-numeric argument to binary operator" is not really indicating clearly why the error occurs. A simple rearranging of the code order and selecting only the isotope columns will give the user the flexibility to have also these columns in the discrimination data and not encounter this error anymore. Although I know that another column in the discrimination CSV is rather pointless (but maybe someone wants to store the doi of the reference if TEF is not determined experimentally), I have seen this happen to users which causes unnecessary confusion. All 33 tests were passed with this change.

Kind regards, Eric