MixSIAR
MixSIAR copied to clipboard
Easy way to set discr=0
I am hoping to use mixSIAR to determine source contributions to plant water uptake. It would be nice to have a simple way in this case to set discrimination =0, since no fractionation is involved, normally, with plant water uptake. The issues I am running into involve uploading source and discrimination data. With the discr data I get the following error:
Error in row.names<-.data.frame
(*tmp*
, value = c(0L, 0L, 0L, 0L, 0L, :
duplicate 'row.names' are not allowed
In addition: Warning message:
non-unique value when setting 'row.names': ‘0’
With source data I am not able to include a fixed effect (season) without running into this error: Error in list.sources.bylev[[lev]] <- SOURCE[SOURCE[, source_factors] == : attempt to select less than one element in integerOneIndex Thanks! Maged
The only way I was able to upload my source data without the following error was to input the data as "means" rather than "raw" data. Error in list.sources.bylev[[lev]] <- SOURCE[SOURCE[, source_factors] == : attempt to select less than one element in integerOneIndex
With the discrim data I manually created a data frame with my two factors "soil" and "month" along with the "MeandD" and "SDdD" set to "0" for no fractionation of source water.
Any explanation of the above error and how to resolve it would be helpful. Thanks, Maged
Hello,
I am interested in looking at the proportion of several potential prey items to a consumer over 6 months (using "Sample_Month" as a factor). When I load my source data as raw data (including Sample_Month as a factor), I get the same error that mnosshi described earlier in this same feed:
Error in list.sources.bylev[[lev]] <- SOURCE[SOURCE[, source_factors] == : attempt to select less than one element in integerOneIndex
I do not get an error when Sample_Month is excluded from my raw source data. Also, as with mnosshi, if I summarize the source data into means and sds including Sample_Month as a factor, then the model runs just fine.
Not sure if this helps, but here are some examples of my data:
My consumer data looks like this:
head(consumer_dat)
d13C d15N Sample_Month 1 -23.06208 12.35101 7 2 -22.48184 12.49636 7 3 -23.47745 13.25309 7 4 -21.39577 12.98798 8 5 -24.13050 13.18641 8 6 -22.51452 12.17074 8
My source data when run as raw data looks like this:
head(source_dat) Sample_Month d13C d15N 1 SmallFishes 7 -29.510 8.99 2 SmallFishes 7 -27.320 12.11 3 SmallFishes 8 -22.106 9.68 4 SmallFishes 8 -24.050 10.96 5 Invertebrates 7 -21.510 9.83 6 Invertebrates 8 -20.460 9.79
Code for loading the source data looks like this: source <- load_source_data(filename="data/source_dat.csv", source_factors="Sample_Month", conc_dep=FALSE, data_type="raw", mix)
Of course, I would prefer using the raw data, if possible. If anyone has any ideas for how to move forward with this, I would very much appreciate it.
Thank you, Ann-Marie
p.s. mnosshi-- did you ever figure out the issue?
I am not sure this is exactly what you need, but I was able to run the model separately for each month. In my case month was a significant factor, and a relevant factor conceptually, therefore it made sense for me to run a separate model by month. The problem has something to do with both the soil depth (sources) and the month varying. "Error in load_source_data(filename = source.filename, source_factors = "month", : Sources for each level of month do not match. If you have different sources (or # of sources) for levels of month, you must fit separate MixSIAR models for each level.”
Unfortunately, I was only able to load sources as means, SD, and could not get past the issue with running the raw data. At one point I got errors about duplicate row names in the discriminate. That makes sense to me if it’s trying to use that row of data to discriminate the analysis (it can’t figure out what to do with the duplicate rows).
If it makes sense, try to run the model separately for each month, and it should work... Good luck, Maged Nosshi
On Tue, Mar 5, 2019 at 12:30 PM Ann-Marie [email protected] wrote:
Hello,
I am interested in looking at the proportion of several potential prey items to a consumer over 6 months (using "Sample_Month" as a factor). When I load my source data as raw data (including Sample_Month as a factor), I get the same error that mnosshi described earlier in this same feed:
Error in list.sources.bylev[[lev]] <- SOURCE[SOURCE[, source_factors] == : attempt to select less than one element in integerOneIndex
I do not get an error when Sample_Month is excluded from my raw source data. Also, as with mnosshi, if I summarize the source data into means and sds including Sample_Month as a factor, then the model runs just fine.
Not sure if this helps, but here are some examples of my data:
My consumer data looks like this:
head(consumer_dat) d13C d15N Sample_Month 1 -23.06208 12.35101 7 2 -22.48184 12.49636 7 3 -23.47745 13.25309 7 4 -21.39577 12.98798 8 5 -24.13050 13.18641 8 6 -22.51452 12.17074 8
My source data when run as raw data looks like this:
head(source_dat) Sample_Month d13C d15N 1 SmallFishes 7 -29.510 8.99 2 SmallFishes 7 -27.320 12.11 3 SmallFishes 8 -22.106 9.68 4 SmallFishes 8 -24.050 10.96 5 Invertebrates 7 -21.510 9.83 6 Invertebrates 8 -20.460 9.79
Code for loading the source data looks like this: source <- load_source_data(filename="data/source_dat.csv", source_factors="Sample_Month", conc_dep=FALSE, data_type="raw", mix)
Of course, I would prefer using the raw data, if possible. If anyone has any ideas for how to move forward with this, I would very much appreciate it.
Thank you, Ann-Marie
p.s. mnosshi-- did you ever figure out the issue?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/brianstock/MixSIAR/issues/150#issuecomment-469825515, or mute the thread https://github.com/notifications/unsubscribe-auth/Acl6rdHMwXP6WOJ3wbLesyDiVUwshFy3ks5vTsXAgaJpZM4W_VAn .
Thanks Maged,
I really appreciate your quick reply. I have been able to run each month separately too, but was hoping to run fewer models (and combine months) to share information across months. I guess I will just use the summarized means and SDs, which is fine, but loses a little information.
Thanks again!
Ann-Marie