Description Usage Arguments Details Value Note Author(s) Examples
Read a delimited (*.csv) file containing time-depth
recorder (TDR) data from various TDR models. Return a
TDR
or TDRspeed
object. createTDR
creates an
object of one of these classes from other objects.
1 2 3 4 5 6 |
file |
character: a string indicating the path to the file to
read. This can also be a text-mode connection, as allowed in
|
dateCol |
integer: column number containing dates, and optionally, times. |
timeCol |
integer: column number with times. |
depthCol |
integer: column number containing depth readings. |
speed |
logical: whether speed is included in one of the columns of concurrentCols. |
subsamp |
numeric scalar: subsample rows in |
concurrentCols |
integer vector of column numbers to include as concurrent data collected. |
dtformat |
character: a string specifying the format in which the
date and time columns, when pasted together, should be interpreted
(see |
tz |
character: a string indicating the time zone assumed for the date and time readings. |
... |
Passed to |
time |
A |
depth |
numeric vector with depth readings. |
concurrentData |
|
dtime |
numeric scalar: sampling interval used in seconds. If
missing, it is calculated from the |
The input file is assumed to 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. However, depth and speed are assumed to be in m, and m/s, respectively, for further analyses.
If speed is TRUE and concurrentCols contains a column named
speed or velocity, then an object of class TDRspeed
is
created, where speed is considered to be the column matching this
name.
An object of class TDR
or TDRspeed
.
Although TDR
and TDRspeed
classes
check that time stamps are in increasing order, the integrity of the
input must be thoroughly verified for common errors present in text
output from TDR devices such as duplicate records, missing
time stamps and non-numeric characters in numeric fields. These
errors are much more efficiently dealt with outside of GNU
R using tools like GNU awk
or GNU sed
, so
diveMove
does not currently attempt to fix these
errors.
Sebastian P. Luque spluque@gmail.com
1 2 3 4 5 6 7 8 9 10 11 12 13 | ## Do example to define object zz with location of dataset
utils::example("dives", package="diveMove",
ask=FALSE, echo=FALSE)
srcfn <- basename(zz)
readTDR(zz, speed=TRUE, sep=";", na.strings="", as.is=TRUE)
## Or more pedestrian
tdrX <- read.csv(zz, sep=";", na.strings="", as.is=TRUE)
date.time <- paste(tdrX$date, tdrX$time)
tdr.time <- as.POSIXct(strptime(date.time, format="%d/%m/%Y %H:%M:%S"),
tz="GMT")
createTDR(tdr.time, tdrX$depth, concurrentData=data.frame(speed=tdrX$speed),
file=srcfn, speed=TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.