WqData-class(wq)
WqData-class()所属R语言包:wq
Class "WqData"
类“WqData”
译者:生物统计家园网 机器人LoveR
描述----------Description----------
A simple extension or subclass of the "data.frame" class for typical “discrete” water quality monitoring programs that examine phenomena on a time scale of days or longer. It requires water quality data to be in a specific “long” format, although a generating function wqData can be used for different forms of data.
一个简单的延伸或子类的"data.frame"类典型的“离散”水质监测方案,审查天或更长的时间尺度上的现象。它需要水的质量数据,以在一个特定的“长”格式,虽然生成函数wqData可以用于不同形式的数据。
类对象----------Objects from the Class----------
Objects can be created by calls of the form new("WqData", d), where d is a data.frame. d should have columns named time, site, depth, variable, value of class "DateTime", "factor", "numeric", "factor", "numeric", respectively.
可以创建对象通过调用的形式new("WqData", d),其中d是一个数据框。 d应该有time, site, depth, variable, value类"DateTime", "factor", "numeric", "factor", "numeric",分别列名为。
插槽----------Slots----------
.Data: Object of class "data.frame" as described above
.Data:对象的类"data.frame"上述
Automatically created slots:
自动创建插槽:
names: Object of class "character" containing the names of the original data.frame.
names:类的对象"character"包含的原始数据框的名称。
row.names: Object of class "data.frameRowLabels" containing the row names of the original data.frame.
row.names:类的对象"data.frameRowLabels"包含该行的原始数据框的名称。
.S3Class: Object of class "character" describing which S3 class is extended by this class.
.S3Class:类的对象"character",它描述了S3类扩展这个类。
扩展----------Extends----------
Class "data.frame", directly. Class "list", by class "data.frame", distance 2. Class "oldClass", by class "data.frame", distance 2. Class "vector", by class "data.frame", distance 3.
类"data.frame",直接。类"list",“data.frame”类,距离2。类"oldClass",“data.frame”类,距离2。类"vector",“data.frame”类,距离3。
方法----------Methods----------
plot signature(x = "WqData"):
图signature(x = "WqData"):
plot(x, vars, num.col = NULL)
图(X,增值经销商,num.col = NULL)
Multiple plots, each containing boxplots of data at each site for the same variable. An argument vars can be given specifying a character string of variables to be plotted. Otherwise, only the first 10 variables will be plotted if the number of variables is more than 10. The number of columns plotted is determined automatically unless num.col is given an integer value.
多块,每个数据在每个站点为同一个变量的盒形图。参数vars可以被绘制指定的字符串变量。否则,只在第一个10个变量的变量的数量,如果超过10,将被绘制。绘制的列数自动确定,除非num.col被赋予一个整数值。
summary signature(x = "WqData"):
总结signature(x = "WqData"):
summary(x)
摘要(X)
Date range, number of observations for each combination of site and variable, and quartiles of variable values.
日期范围,站点和变量的每一种组合的观测数,和四分位数的变量值。
tsMake signature(x = "WqData"): see tsMake,WqData-method
tsMakesignature(x = "WqData"):看tsMake,WqData-method
参见----------See Also----------
DateTime-class, tsMake,WqData-method, wqData
DateTime-class,tsMake,WqData-method,wqData
实例----------Examples----------
showClass("WqData")
## Make a WqData object from sfbay data:[#一个WqData数据从sfbay对象:]
## Combine date and time into a POSIXct object called time.[结合日期和时间到一个POSIXct的对象被称为时间。]
## In this case, requires first making sure all sfbay times have 4[#在这种情况下,首先需要确保所有sfbay时间4]
## digits. Also drop date, which is no longer needed.[#数字。同时删除日期,而不再需要。]
sfb1 <- transform(sfbay, time = substring(10000 + time, 2, 5))
sfb1 <- transform(sfb1, time = paste(date, time, sep = " "))
sfb1 <- transform(sfb1, time = as.POSIXct(time, format = "%m/%d/%Y %H%M"))
sfb1$date <- NULL
## If time of day were not needed, then the following would suffice:[#如果一天中的时间是没有必要的,那么下面就足够了:]
## sfb1 <- transform(sfbay, time = as.Date(date, "%m/%d/%Y"))[#SFB1 < - 的变换(sfbay,时间= as.Date(日期,“%M /%D /%Y”))]
## sfb1$date <- NULL[#SFB1日< - NULL]
## 'Melt' the data into the correct format[#“熔体”正确的格式的数据转换成]
## which automatically gives required variable and value fields.[#它会自动提供所需的变量和值字段。]
require(reshape2)
m1 <- melt(sfb1, id.vars = c('time', 'stn', 'depth'))
## Make sure names of id.vars conform to WqData requirements[#请确保的id.vars名符合要求WqData的]
names(m1)[2] <- "site"
## Make sure all column classes conform to WqData requirements[#确保所有列类符合WqData要求]
m1 <- transform(m1,
site = factor(paste("s", site, sep = ""), ordered = TRUE)
)
## Remove NAs[#删除NAS]
m1 <- subset(m1, !is.na(value))
rownames(m1) <- 1:nrow(m1)
## Create the new WqData object[#创建新的WqData的对象]
sfb <- new('WqData', m1)
## Summarize the data[#汇总数据]
summary(sfb)
## Create boxplot summary of data[#创建一个盒形图的数据汇总]
plot(sfb, vars = c('chl', 'dox', 'spm'), num.col = 2)
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|