load_source_data specifies the source data structure (factors, concentration dependence, data type) and loads the source data file. Sources are sorted alphabetically.

load_source_data(filename, source_factors = NULL, conc_dep, data_type, mix)

Arguments

filename

character, csv file with the source data.

source_factors

character, column heading in 'filename' that matches a Fixed or Random Effect from the mixture data (mix$factors). Only used if you have source data by a factor (e.g. "Region"), otherwise NULL.

conc_dep

T/F, TRUE indicates you have concentration dependence data in 'filename'.

data_type

"raw" or "means". "Raw" source data are repeated source biotracer measurements, "means" data are source biotracer values as means, SDs, and sample size. See manual for formatting.

mix

list, output from load_mix_data.

Value

source, a list including:

  • source$n.sources: integer, number of sources

  • source$source_names: vector, source names/labels

  • source$S_MU: matrix, source means used for plotting - NOT passed to JAGS. If sources are by factor, then the third column of S_MU will be the factor values (e.g. for 4 sources and 3 Regions: 1 2 3 1 2 3 1 2 3 1 2 3)

  • source$S_SIG: matrix, source SDs used for plotting - NOT passed to JAGS. Same structure as S_MU.

  • source$S_factor1: factor or NULL, factor values if sources are by factor.

  • source$S_factor_levels: scalar or NULL, number of S_factor1 levels if sources are by factor.

  • source$conc: matrix or NULL, concentration dependence values for each isotope

  • source$MU_array: array of source means, dim(src,iso,f1) or dim(src,iso) if data_type="means", NULL if data_type="raw".

  • source$SIG2_array: array of source variances, dim(src,iso,f1) or dim(src,iso) if data_type="means", NULL if data_type="raw".

  • source$n_array: vector/matrix of source sample sizes, dim(src,f1) or dim(src) if data_type="means", NULL if data_type="raw".

  • source$SOURCE_array: array of source data, dim(src,iso,f1,replicate) or dim(src,iso,replicate) if data_type="raw", NULL if data_type="means".

  • source$n.rep: vector/matrix of source sample sizes, dim(src,f1) or dim(src) if data_type="raw", NULL if data_type="means".

  • source$by_factor: NA or factor number, are the source data by a Fixed or Random Effect?

  • source$data_type: "raw" or "means", same as input.

  • source$conc_dep: T/F, same as input.

Details

WARNING messages check for:

  • More than one source factor selected

  • Source factor not in mixture data

  • Source sample sizes missing or entered incorrectly

  • Source SD = 0

See also