xyt.lxy: Create a LoCoH-xy object

Description Usage Arguments Details Value See Also Examples

Description

Creates a LoCoH-xy object from a set of location data

Usage

1
2
3
4
5
6
xyt.lxy(xy, dt = NULL, tz = NULL, id = NULL, ptid = NULL,
  proj4string = CRS(as.character(NA)), anv = NULL, anv.desc = NULL,
  col = NULL, del.dup.xyt = TRUE, dup.dt.check = TRUE,
  show.dup.dt = FALSE, dt.int.round.to = 0.1, tau.diff.max = 0.02,
  req.id = TRUE, warn.latlong = TRUE, show.bad.timestamps = FALSE,
  status = TRUE)

Arguments

xy

A two-column matrix or data frame containing the xy coordinates of the points

dt

Optional vector of date-time values (either POSIXct objects or objects that can be coerced to POSIXct)

tz

The name of the time zone that will be assigned if not explicit in dt.

id

Optional character vector or factor containing the name(s) of the individual(s) of each location.

ptid

Optional integer vector of point id values

proj4string

Projection string object of class CRS-class

anv

Optional ancillary variables for each point (data frame with same number of records as xy)

anv.desc

Optional character vector with descriptions of the ancillary variables (in the same order as they appear in anv)

col

Optional vector of color values (one for each point), or a single color value

del.dup.xyt

Whether to delete duplicate rows with the same x, y, dt, and id value. (T/F)

dup.dt.check

Whether to check to make sure there are no duplicate date values for the same id

show.dup.dt

Whether to show duplicate time stamps (if found) (T/F)

dt.int.round.to

The proportion of the median sampling frequency that time intervals will be rounded to when computing the frequency table of sampling intervals (no change is made to the time stamps)

tau.diff.max

The maximum deviation from the median sampling interval (tau), expressed as a proportion of the median sampling interval, see details

req.id

Require a value for id (T/F)

warn.latlong

Show a warning message if coordinates appear to be in geographic coordinates (T/F)

show.bad.timestamps

If TRUE, will print any timestamps that didn't successfully convert to a POSIXct object (T/F)

status

Show status messages (T/F)

Details

At a minimum, a LoCoH-xy object contains a set of points. It can also contain date-time values for each point, the name of the individual(s) associated with each point, and a nearest nieghbors lookup table.

Importing date-time values into R is often a painful process. You may want to try exporting your date-time values from your spreadsheet or database as a text field that is formatted in a style that R will recognize as a valid time. To see a date-time format that R will be able to convert to a date- time object (class POSIXct), type Sys.time() at the console. Once you've noted the date-time format recognized by R, try to format the date field in your spreadsheet or database in a similar manner, then export the values in a text format (e.g., csv). For example in MS Access, you can use the format() function as part of a query to format a date field, e.g. format(PointDate, "yyyy-mm-dd hh:nn:ss"). In Excel, you can go to Format - Cells and give the date-time cells a custom format yyyy-mm-dd hh:mm:ss. See the Appendices of the T-LoCoH tutorial for more examples.

The time zone paramter tz is optional. If tz is omitted, R will try to get the timezone from dt, and if there is no timezone specified set it to UTC. Valid timezone names are to some extent OS specific. To see valid timezone names, you may run OlsonNames(). If dt is of class POSIXct (which stores the time zone) and a different value for tz is passed, a prompt will ask whether date values should be converted.

By default, if the function finds two or more locations with the same time stamp for the same id (individual), an error will be triggered. This usually results from a data processing error (e.g., duplication of a row), or a conversion problem or rounding issue in the time stamp values. To see which records have duplicate time stamps, pass show.dup.dt=TRUE. To disable the checking for duplicate time stamps, pass dup.dt.check=TRUE. Duplicate locations are allowed, as are duplicate time stamps for different individuals.

ptid is an optional vector of numeric id values (i.e., primary key) for each location. When present, point id values of parent points will be saved in the data table of hulls. This enables linking the outputs of tlocoh (hulls and hull metrics) with other data and/or other software tools. See also lhs.exp.csv and lhs.exp.shp. ptid should not be confused with id, which is a character vector of the name(s) of the individuals in the dataset.

tau.diff.max controls which consecutive pairs of points will be used to compute the median step length (d-bar) and the maximum observed speed (v-max). Pairs of points whose sampling interval (i.e., time difference) deviates from the median by more than tau.diff.max will be excluded from this computation (presumably because there was a drop-out in the data, and the distance between those pairs of locations does not represent the characteristic movement pattern). However for data that have a wide distribution of sampling intervals (e.g., manually collected radio telemetry locations), this filtering may result in an insufficient number of pairs. In this case, increase tau.diff.max or set it to zero to disable filtering completely.

Other variables, including environmental variables or biometric variables can be brought in using the anv parameter. These variables can then be used in hull metrics.

Value

A object of class locoh.lxy

See Also

lxy.nn.add, lxy.repair, lxy.subset

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## Not run: 
#Create an unbounded random walk as a sample dataset
n <- 500; stepsize <- 5
theta <- runif(n, min=0, max=2*pi)
start <- c(100,100)
xy <- data.frame(x=start[1]+cumsum(stepsize * cos(theta)), y=start[2]+cumsum(stepsize*sin(theta)))
plot(xy, pch=20, type="b", lty=1)
timestamps <- Sys.time() + 3600 * (1:n-1)

#Combine the xy locations and timestamps into a LoCoH-xy object
lxy <- xyt.lxy(xy=xy, dt=timestamps, id="broken_tooth")
summary(lxy)

## End(Not run)

tlocoh documentation built on May 2, 2019, 5:27 p.m.