'Using "raw" source data in MixSIAR package and also grouping by random factor

I'm using the MixSIAR package in R to estimation proportional water source use (groundwater versus soil moisture) by different tree species based on stable oxygen isotope data. The package provides the option to use "raw" source data (individual values) or "mean" values (mean, SD, and number of observations). Help vignettes walk through how to format "mean" source value data to include a categorical variable (e.g., site) to group source values (like in the Wolves example), however I can't find any example of how to format "raw" data to also include a source value.

data frame format for "mean" values that allow me to use site as a categorical variable:

 source     site     MeanO       SDO     n
 deep well    1   -7.426316   0.2905590 19
 deep well    2   -7.453200   0.3109491 25
 deep well    3   -7.764091   0.3340467 22
 soil         1   -5.927895   2.8232703 38
 soil         2   -6.331538   1.9969892 39
 soil         3   -5.270000   4.2358151 35

My question is, how do I format the source data using "raw" values to also include a categorical variable?

Thanks for the help!

r


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source