MixSIAR
MixSIAR copied to clipboard
Raw data issue
Error provoked when using raw data with a source factor - message is: Error in list.sources.bylev[[lev]] <- SOURCE[SOURCE[, source_factors] == :
If you google it you'll see other instances.
I've had a look at the source code and it seems the problem is that you convert SOURCE[, source_factor_cols]
to numeric, but then try to iterate over the levels of SOURCE[, source_factor_cols]
later. I'd suggest converting it back to factor, but it's not clear from the code whether the iteration expects the original factor levels or the 'new' numeric factor levels.
Additionally later (having tested converting the numeric column to a factor) an error is provoked by this line if (length(unique(list.sources.bylev)) != 1)
. Are you sure you don't want to go all(sapply(
and then test that each item of the list has only one unique value? Otherwise length()
will just return the number of items in the list ie the number of levels in the source factor.
Cheers
Andre
Hi Andre,
Thanks for the suggestion. I'm happy to look into it if you provide a reproducible example and output of sessionInfo()
.
Thank you for asking, I'm having the same issue! Sounds like I'll need to follow up with a reproducible example and directly ask Brian.