tsMake(wq)
tsMake()所属R语言包:wq
Create time series from water quality data
建立水质数据时间序列
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Creates a matrix time series object from an object of class "WqData", either all variables for a single site or all sites for a single variable.
创建一个矩阵的时间序列对象类的一个对象"WqData",无论是单个站点或单个变量的所有网站的所有变量。
用法----------Usage----------
## S4 method for signature 'WqData'
tsMake(object, focus, layer,
type = c("ts.mon", "zoo"), qprob = NULL)
参数----------Arguments----------
参数:object
Object of class "WqData".
对象类"WqData"。
参数:focus
Name of a site or water quality variable.
一个网站或水质变量的名称。
参数:layer
Number specifying a single depth; a numeric vector of length 2 specifying top and bottom depths of layer; a list specifying multiple depths and/or layers; or just the string "max.depths".
编号指定一个单一深度;指定层的顶部和底部深度的长度为2的一个数值向量;指定多个探测深度和/或层的列表;或只是字符串"max.depths"。
参数:type
ts.mon to get a monthly time series, zoo to get an object of class "zoo" with individual observation dates.
ts.mon获得月度时间序列,zoo得到的对象类"zoo"个人观察日。
参数:qprob
quantile probability, a number between 0 and 1.
分量的概率,在0和1之间的一个数。
Details
详细信息----------Details----------
When qprob = NULL, the function averages all included depths for each day, the implicit assumption being that the layer is well-mixed and/or the samples are evenly distributed with depth in the layer. If layer = "max.depths", then only the value at the maximum depth for each time, site and variable combination will be used. If no layer is specified, all depths will be used.
当qprob = NULL,该函数的平均值的每一天的所有包含深度,隐含的假设是,该层是充分混合和/或将样品均匀地分布在该层中随深度。如果layer = "max.depths"的值,则仅在最大深度将被用于为每个时间,地点和变量组合。如果没有指定层时,所有的深度将被使用。
The function produces a matrix time series of all variables for the specified site or all sites for the specified variable. If type = "ts.mon", available daily data are averaged to produce a monthly time series, from which a quarterly or annual series can be created if needed. If you want values for the actual dates of observation, then set type = "zoo".
函数生成一个矩阵的所有变量指定的网站或所有网站指定的变量的时间序列。如果type = "ts.mon",每天提供的数据平均到每月产生的时间序列,如果需要的话,可以创建一个季度或年度系列。如果你想观察的实际日期值,然后将type = "zoo"。
When qprob is a number from 0 to 1, it is interpreted as a probability and the corresponding quantile is used to aggregate observations within the specified layer. So to get the maximum, for example, use qprob = 1. If type = "ts.mon", the same quantile is used to aggregate all the available daily values.
当qprob是一个从0到1的数字,它被解释为概率指定的层内和相应的分位数用于聚合观测。因此,为了得到最大的,例如,使用qprob = 1。如果type = "ts.mon",相同的位数是用来聚集所有可用的每日摄取量。
值----------Value----------
A matrix of class "mts" or "zoo".
的矩阵类"mts"或"zoo"。
注意----------Note----------
The layer list is allowed to include negative numbers, which may have been used in the WqData object to denote variables that apply to the water column as a whole, such as, say, -1 for light attenuation coefficient. This enables focus = 's27' and layer = list(-1, c(0, 5)) to produce a time series matrix for station 27 that includes both attenuation coefficient and chlorophyll averaged over the top 5 m. Negative numbers may also have been used in the WqData object to identify qualitative depths such as “near bottom”, which is not uncommon in historical data sets. So data from such depths can be aggregated easily with other data to make these time series.
层列表允许包括负数,它可能已被用于在WqData对象表示适用于作为一个整体的水柱的变量,如,例如,-1为光衰减系数。这使得focus = 's27'和layer = list(-1, c(0, 5))产生的时间站27系列矩阵,包括衰减系数和的叶绿素平均超过前5米。负数也被用来在WqData对象识别质的深度,如“接近底部”,这是不寻常的历史数据集。因此,这样的深度数据可以轻松地与其他数据汇总,以使这些时间序列。
参见----------See Also----------
WqData-class
WqData-class
实例----------Examples----------
# Create new WqData object[建立新的WqData对象]
sfb <- wqData(sfbay, c(1, 3:4), 5:12, site.order = TRUE,
time.format = "%m/%d/%Y", type = "wide")
# Find means in the 0-10 m layer[查找方式在0-10米层]
y <- tsMake(sfb, focus = 's27', layer = c(0, 10))
plot(y, main = 'Station 27')
# Or select medians in the same layer[或者选择在同一层的中位数]
y1 <- tsMake(sfb, focus = 's27', layer = c(0, 10), qprob = 0.5)
plot(y1, main = 'Station 27')
# Compare means:medians[比较“手段”:“中位数”]
apply(y/y1, 2, mean, na.rm=TRUE)
# Combine a layer with a single additional depth[结合的层,与一个单一的附加深度]
y <- tsMake(sfb, focus = 'chl', layer = list(c(0, 2), 5))
plot(y, main = 'Chlorophyll a, ug/L')
# Use values from the deepest samples[从最深的样本值]
y <- tsMake(sfb, focus = 'dox', layer = "max.depths", type = 'zoo')
head(y)
plot(y, type="h", main = "'Bottom' DO, mg/L")
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|