formatDistData(unmarked)
formatDistData()所属R语言包:unmarked
Bin distance data
宾距离数据
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Convert individual-level distance data to the transect-level
将个体水平的距离数据,样带
用法----------Usage----------
参数----------Arguments----------
参数:distData
data.frame where each row is a detected individual. Must have at least 2 columns. One for distances and the other for transect names.
数据框,其中每一行是一个检测到的个人。必须至少有2列。距离和其他横断面的名称之一。
参数:distCol
character, name of the column in distData that contains the distances. The distances should be numeric.
字符,名称,其中包含的距离中的列distData。距离应该是数字。
参数:transectNameCol
character, column name containing transect names. The transect column should be a factor.
字符,列名包含样的名字。样列应该是一个因素。
参数:dist.breaks
numeric vector of distance interval cutpoints. Length must equal J+1.
数字矢量的距离间隔分割点。长度必须等于J +1。
参数:occasionCol
optional character. If transects were visited more than once, this can be used to format data for gdistsamp. It is the name of the column in distData that contains the occasion numbers. The occasion column should be a factor.
可选的字符。如果断面进行了走访一次以上,这可以用来格式化数据gdistsamp。这是名称的的列中distData包含之际编号。之际列应该是一个因素。
Details
详细信息----------Details----------
This function creates a site (M) by distance interval (J) response matrix from a data.frame containing the detection distances for each individual and the transect names. Alternatively, if each transect was surveyed T times, the resulting matrix is M x JT, which is the format
这个函数创建一个网站(M)的距离间隔(J)响应矩阵,数据框包含的探测距离为每个断面的名称。或者,如果每个断面调查T次,所得到的矩阵为M×JT,这种格式
值----------Value----------
An M x J or M x JT matrix containing the binned distance data. Transect names will become rownames and colnames will describe
的M个J或M X JT矩阵分级的距离数据。断面名称将成为行名和列名描述
注意----------Note----------
It is important that the factor containing transect names includes levels for all the transects surveyed, not just those with >=1 detection. Likewise, if transects were visited more than once, the factor containing the occasion numbers should include levels for all
这是重要的,该因素含有断面名字包括所有调查断面的水平,而不仅仅是那些与> = 1检测。同样地,如果断面被访问一次以上,该因子含有的场合号码应该包括可用于所有的水平
参见----------See Also----------
distsamp, unmarkedFrame
distsamp,unmarkedFrame
实例----------Examples----------
# Create a data.frame containing distances of animals detected[创建一个数据框包含检测到的动物的距离]
# along 4 transects.[沿4断面。]
dat <- data.frame(transect=gl(4,5, labels=letters[1:4]),
distance=rpois(20, 10))
dat
# Look at your transect names.[看你的样的名称。]
levels(dat$transect)
# Suppose that you also surveyed a transect named "e" where no animals were[假设您还调查了样,命名为“e”上没有动物]
# detected. You must add it to the levels of dat$transect[检测。您必须将它添加到的那样的水平]
levels(dat$transect) <- c(levels(dat$transect), "e")
levels(dat$transect)
# Distance cut points defining distance intervals[定义的距离间隔距离的切点]
cp <- c(0, 8, 10, 12, 14, 18)
# Create formated response matrix[创建格式化的响应矩阵]
yDat <- formatDistData(dat, "distance", "transect", cp)
yDat
# Now you could merge yDat with transect-level covariates and[现在,你可以合并yDat样水平的协变量,]
# then use unmarkedFrameDS to prepare data for distsamp[然后使用unmarkedFrameDS准备为distsamp的数据]
## Example for data from multiple occasions[#示例数据从多个场合]
dat2 <- data.frame(distance=1:100, site=gl(5, 20),
visit=factor(rep(1:4, each=5)))
cutpt <- seq(0, 100, by=25)
y2 <- formatDistData(dat2, "distance", "site", cutpt, "visit")
umf <- unmarkedFrameGDS(y=y2, numPrimary=4, survey="point",
dist.breaks=cutpt, unitsIn="m")
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|