readLocs: Read comma-delimited file with location data

readLocsR Documentation

Read comma-delimited file with location data

Description

Read a delimited (*.csv) file with (at least) time, latitude, longitude readings.

Usage

readLocs(
  locations,
  loc.idCol,
  idCol,
  dateCol,
  timeCol = NULL,
  dtformat = "%m/%d/%Y %H:%M:%S",
  tz = "GMT",
  classCol,
  lonCol,
  latCol,
  alt.lonCol = NULL,
  alt.latCol = NULL,
  ...
)

Arguments

locations

character: a string indicating the path to the file to read, or a data.frame available in the search list. Provide the entire path if the file is not on the current directory. This can also be a text-mode connection, as allowed in read.csv.

loc.idCol

integer: column number containing location ID. If missing, a loc.id column is generated with sequential integers as long as the input.

idCol

integer: column number containing an identifier for locations belonging to different groups. If missing, an id column is generated with number one repeated as many times as the input.

dateCol

integer: column number containing dates, and, optionally, times.

timeCol

integer: column number containing times.

dtformat

character: a string specifying the format in which the date and time columns, when pasted together, should be interpreted (see strptime) in file.

tz

character: a string indicating the time zone for the date and time readings.

classCol

integer: column number containing the ARGOS rating for each location.

lonCol

integer: column number containing longitude readings.

latCol

integer: column number containing latitude readings.

alt.lonCol

integer: column number containing alternative longitude readings.

alt.latCol

integer: Column number containing alternative latitude readings.

...

Passed to read.csv

Details

The file must have a header row identifying each field, and all rows must be complete (i.e. have the same number of fields). Field names need not follow any convention.

Value

A data frame.

Author(s)

Sebastian P. Luque spluque@gmail.com

Examples

## Do example to define object zz with location of dataset
utils::example("sealLocs", package="diveMove",
               ask=FALSE, echo=FALSE)
locs <- readLocs(zz, idCol=1, dateCol=2,
                 dtformat="%Y-%m-%d %H:%M:%S", classCol=3,
                 lonCol=4, latCol=5, sep=";")

summary(locs)

spluque/diveMove documentation built on Jan. 27, 2024, 12:43 p.m.