set_obs: Set observations in a network model

View source: R/ui_model-building.R

set_obsR Documentation

Set observations in a network model

Description

Set observations in a network model

Usage

set_obs(nm, data, comp, size, prop, time, group_by)

Arguments

nm

A networkModel object (e.g. output from new_networkModel)

data

A tibble containing the observations. If NULL, remove observations from the model.

comp

String, name of the data column with the compartment names

size

String, name of the data column with the compartment sizes

prop

String, name of the data column with the compartment proportions of heavy tracer

time

String, name of the data column with the sampling times

group_by

Optional vector of string giving the names of the columns to use for grouping the data into replicates

Value

A networkModel object.

Examples

# Using the topology from the Trinidad case study
m <- new_networkModel() %>%
  set_topo("NH4, NO3 -> epi, FBOM", "epi -> petro, pseph",
           "FBOM -> tricor", "petro, tricor -> arg")

# Taking initial condtions from the 'lalaja' dataset at t=0
inits <- lalaja[lalaja[["time.days"]] == 0, ]
inits
m <- set_init(m, inits, comp = "compartment", size = "mgN.per.m2",
              prop = "prop15N", group_by = "transect")
m

# Taking observations from 'lalaja'
m <- set_obs(m, lalaja[lalaja[["time.days"]] > 0, ], time = "time.days")
m
plot(m)


isotracer documentation built on Sept. 22, 2023, 1:07 a.m.