-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathadd_st.Rd
50 lines (46 loc) · 1.52 KB
/
add_st.Rd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/Data_handling.R
\name{add_st}
\alias{add_st}
\title{Apply Storage Flux Correction}
\usage{
add_st(flux, st, stp = NULL, name_out = "-")
}
\arguments{
\item{flux}{A numeric vector with flux values.}
\item{st}{A numeric vector with storage computed using discrete
(one point) approach.}
\item{stp}{A numeric vector with storage computed using
profile measurement of CO2.}
\item{name_out}{A character string providing \code{varnames} value of the
output.}
}
\value{
A vector with attributes \code{varnames} and \code{units} is
produced. \code{varnames} value is set by \code{name_out} argument.
\code{units} value is extracted from \code{flux} vector by
\code{\link{units}} or set to default \code{"-"}.
}
\description{
Correction of matter or energy flux (\code{flux}) with storage computed using
discrete (one point) approach (\code{st}) or profile measurement of CO2
concentration (\code{stp}).
}
\details{
If both storage estimates are available, \code{stp} takes priority. If both
\code{st} and \code{stp} estimates are \code{NA}, original flux value is
kept. \code{flux}, \code{st} and \code{stp} (if not NULL) must have the same
length.
}
\examples{
aa <- matrix(ncol = 3, nrow = 10, byrow = TRUE, c(-1, 1, 2),
dimnames = list(NULL, c("flux", "st", "stp")))
aa[c(4, 8, 9, 11, 15, 18, 22, 25, 27, 29)] <- NA
(aa <- as.data.frame(aa))
aa$flux_stc <- add_st(aa$flux, aa$st, aa$stp, "flux_stc")
aa
lapply(aa, attributes)
}
\seealso{
\code{\link{units}}.
}