Learn R Programming

move (version 1.0)

move: Create a Move object

Description

The move method creates Move or MoveStack object from Movebank or other (compressed) csv files. If you use your own data you need to set the projection method with the 'proj' argument and specify in which column of your data the function finds locations and timestamps.

Usage

## S3 method for class 'character,missing,missing,missing,missing':
move(x)
## S3 method for class 'numeric,numeric,POSIXct,data.frame,ANY':
move(x, y, time, data, proj, sensor='unknown',animal='unnamed',...)

Arguments

x
Full path to the file location, OR ca vector with x coordinates if non-Movebank data are provided (e.g. data$x)
y
vector of y coordinates if non-Movebank data are provided
time
column indicator for non-Movebank data for the time stamps, with POSIXct conversion, i.e. as.POSIXct(data$timestamp, format="%Y-%m-%d %H:%M:%S", tz="UTC")
data
Optional extra data associated with the relocation, if empty it is filled with the coordinates and timestamps
proj
projection method for non-Movebank data; requires a valid CRS (see CRS-class) object, like CRS("+proj=longlat +ellps=WGS84"); default is NA
sensor
sensor name, either single character or a vector with length of the number of coordinates
animal
animal ID or name, either single character or a vector with length of the number of coordinates
...
Additional arguments

Details

The easiest way to import data is to download the study you are interested in from www.movebank.org. Set the file path as the x argument of the move function. The function detects whether there are single or multiple individuals in this file and automatically creates either a Move or MoveStack object. Another way is to read in your data using read.csv. Then the columns with the x and y coordinates, and the timestamp, as well as the whole data.frame of the imported data are given to the move function. Again the function detects whether to return a Move or a MoveStack object

Examples

Run this code
## create a move object from a Movebank csv file
data <- move(system.file("extdata","leroy.csv.gz",package="move"))

## create a move object from non-Movebank data
file <- read.table(system.file("extdata","leroy.csv.gz",package="move"), header=TRUE, sep=",", dec=".")
data <- move(x=file$location.long, y=file$location.lat, time=as.POSIXct(file$timestamp, format="%Y-%m-%d %H:%M:%S", tz="UTC"), data=file, proj=CRS("+proj=longlat"), animal="Leroy")
move(x=file$location.long, y=file$location.lat, time=as.POSIXct(file$timestamp, format="%Y-%m-%d %H:%M:%S", tz="UTC"), data=file, proj=CRS("+proj=longlat"))
move(x=1:10,y=1:10,time=as.POSIXct(1:10, origin='1970-1-1'),proj=CRS('+proj=longlat'))
move(x=1:10,y=1:10,time=as.POSIXct(c(1:5,1:5), origin='1970-1-1'),proj=CRS('+proj=longlat'), animal=c(rep('a',5),rep('b',5)))

Run the code above in your browser using DataLab