trip(trip)
trip()所属R语言包:trip
Function to handle animal track data, organized as "trip"s
函数来处理动物跟踪数据,为“旅”
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Extend the basic functionality of a Spatial data frame by specifying the data columns that define the "TimeOrdered" quality of the records.
扩展的基本功能,一个Spatial数据框通过指定定义“TimeOrdered”的质量记录的数据列。
用法----------Usage----------
trip(obj, TORnames)
参数----------Arguments----------
参数:obj
A SpatialPointsDataFrame, containing at least two columns with the DateTime and ID data as per TORnames
ASpatialPointsDataFrame,至少有两列,每TORnames DateTime和ID数据
参数:TORnames
Either an object of TimeOrderedRecords, or a 2-element character vector specifying the DateTime and ID column of obj
任一TimeOrderedRecords,或2元字符矢量对象的指定DateTime和ID列obj
值----------Value----------
A trip object, with the usual slots of a SpatialPointsDataFrame and the added TimeOrderedRecords. For the most part this can be treated as a data.frame with Spatial coordinates.
一个的旅行对象,与通常的插槽的SpatialPointsDataFrame和TimeOrderedRecords。对于在大多数情况下,这可以被视为一个data.frame与Spatial坐标。
(作者)----------Author(s)----------
Michael D. Sumner
参见----------See Also----------
speedfilter, and tripGrid for simple(istic) speed filtering and spatial time spent gridding.
speedfilter,tripGrid(ISTIC)的速度进行简单的过滤和空间花费的时间网格。
实例----------Examples----------
d <- data.frame(x = 1:10, y = rnorm(10), tms = Sys.time() + 1:10, id = gl(2, 5))
coordinates(d) <- ~x+y
tr <- trip(d, c("tms", "id"))
## Not run: [#不运行:]
## a simple example with the common fixes required for basic track data[#一个简单的例子与修复所需的基本轨迹数据]
dat <- read.csv("trackfile.csv")
names(dat) ## e.g. [1] "long" "lat" "seal" "date" "local" "lq"[#例如[1]“长”,“土地增值税”“密封”的“日期”,“本地”,“LQ”]
library(sp)
coordinates(dat) <- c("long", "lat")
## date/times may be in a particular time zone, please check[#日期/时间可能会在特定的时间区域,请检查]
dat$gmt <- as.POSIXct(strptime(paste(dat$date, dat$local),
"
## if there are problems in the data, this will error[#如果有问题的数据,这将错误]
tr <- trip(dat, c("gmt", "seal"))
## the following code tries to fix common problems[#下面的代码试图解决常见问题]
## remove completely-duplicated rows[#删除完全重复的行。]
dat <- dat[!duplicated(dat), ]
## order the rows by seal, then by time[#命令行密封,然后按时间]
dat <- dat[order(dat$seal, dat$gmt), ]
## fudge duplicated times[#捏造复制倍。]
dat$gmt <- adjust.duplicateTimes(dat$gmt, dat$seal)
## finally, convert to Spatial and create trip object[#最后,转换空间和创建行程对象]
coordinates(dat) <- c("long", "lat")
tr <- trip(dat, c("gmt", "seal"))
## End(Not run)[#(不执行)]
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|