importObservations {BayesMassBal}R Documentation

Import Observed Mass Flow Rates

Description

Imports observed mass flow rates stored in a *.csv file and then organizes the data for use with the BMB function.

Usage

importObservations(file, header = TRUE, csv.params = NULL)

Arguments

file

Character string containing the name of *.csv from file which data will be read. See Details below for valid file structures.

header

Logical indicating if the first row of file file contains header information. Current implementation of importObservations discards this information.

csv.params

List of arguments to be passed to read.csv

Details

The purpose of this function is to make it easy to import and structure loosely organized data contained in a *.csv into a list for use as the y argument passed to the BMB function. The entries in file must be organized as such:

importObservations reads the contents of file, sorts the sampling locations numerically, then creates a list of data frames. Each data frame contains the data for a single sample component.

Value

Returns a list of data frames. Each data frame is named according to the unique sample components specified in the second column of file. This list object is intended to be used as the argument y for the BMB function.

Examples


 y <- importObservations(file = system.file("extdata", "twonode_example.csv",
                                      package = "BayesMassBal"),
                   header = TRUE, csv.params = list(sep = ";"))

## The linear constraints for this example data set are:
C <- matrix(c(1,-1,0,-1,0,0,1,-1,0,-1), byrow = TRUE, ncol = 5, nrow = 2)

## The X matrix for this data set can be found using:
X <- constrainProcess(C = C)

[Package BayesMassBal version 1.1.0 Index]