# NOT RUN {
## Example 1
# Extract depth events from transmitters attached
# to crocodiles and plot a single diving event
# Load crocodile data
data(crocs)
Vcrocs <- ReadInputData(infile=crocs,
iHoursToAdd=10,
dateformat = NULL,
sVemcoFormat='1.0')
# Extract depth data for only the transmitter #139
T139 <- ExtractData(Vcrocs,
sQueryTransmitterList = 139)
# Extract increasing depth sensor events
# Start depth event when there is an depth increase of 0.5m within 1 hr
# Max interval between detections = 1 hr
# Complete event when sensor returns within 0.5 of the starting value
T139dives <- RunSensorEventExtraction(T139,
"INCREASE",
"RECEIVERID",
"m",
0.5,
(1*60*60),
(60*60),
0.5)
# The sensor logfile
T139divelog <- T139dives$logtable
# The sensor event file
T139diveevent <- T139dives$event
# Return list of event numbers where sensor events were complete
T139diveevent[which(T139diveevent$ENDREASON=="return"),"SENSOREVENT"]
# Now extract and plot a single sensor event (we have swapped the axes round
# to show the diving behaviour)
mylog <- subset(T139divelog,T139divelog$SENSOREVENT==19)
par(mfrow=c(1,1),las=1,bty="l")
plot(mylog$DATETIME,(mylog$SENSOR1),
xlab="Event duration (mins)",ylab="Depth (m)",type="b",
yaxs = "i", xaxs = "i", ylim = rev(c(0,max(mylog$SENSOR1+0.5))),
xlim = (range(mylog$DATETIME)+(c(-60,30))),
pch=as.character(mylog$RECORD))
title(main=paste("Id=",mylog[1,4],", event=",mylog[1,2], sep=" "))
######################################################
# }
Run the code above in your browser using DataLab