Learn R Programming

tagtools

use_cran_badge()
use_lifecycle_badge("stable")

This repository contains an R package with the R version of the animaltag tool kit. High-resolution movement-sensor tags typically include accelerometers to measure body posture and sudden movements or changes in speed, magnetometers to measure direction of travel, and pressure sensors to measure dive depth in aquatic or marine animals. The sensors in these tags usually sample many times per second. Some tags include sensors for speed, turning rate (gyroscopes), and sound. This package provides software tools to facilitate calibration, processing, and analysis of such data. Tools are provided for: data import/export; calibration (from raw data to calibrated data in scientific units); visualization (for example, multi-panel time-series plots); data processing (such as event detection, calculation of derived metrics like jerk and dynamic acceleration, dive detection, and dive parameter calculation); and statistical analysis (for example, track reconstruction, a rotation test, and Mahalanobis distance analysis).

Installation

You can install the current CRAN version of tagtools with:

install.packages("tagtools")

You can install the development version of tagtools from GitHub with:

# install.packages("devtools")
devtools::install_github("animaltags/tagtools_r")

Further background

Documentation and vignettes are available at: https://animaltags.github.io/tagtools_r/

This material is based upon research supported by the United States Office of Naval Research under Award Number N00014-16-1-3089.

Copy Link

Version

Install

install.packages('tagtools')

Monthly Downloads

187

Version

0.2.0

License

GPL (>= 3)

Maintainer

Stacy DeRuiter

Last Published

June 28th, 2024

Functions in tagtools (0.2.0)

dsf

Estimate the dominant stroke frequency
decz

Decimate sampling rate recursively.
depth2pressure

Convert depth to pressure
depth_rate

Estimate the vertical velocity
detect_peaks

Detect peaks in signal vector data
fix_offset_3d

Estimate the offset in each axis
get_researcher

Find matching researcher in a list of known tag researchers
fit_tracks

Integrate track with reference positions
fix_pressure

Correct a depth or altitude profile
hilbert_env

Compute the envelope of X using Hilbert transform. Compute the envelope of the signal matrix X using the Hilbert transform. To avoid long transforms, this function uses the overlap and add method.
hilbert_transform

Return the Hilbert transform of a signal
extract

Extract a sub-sample of data
extract_cues

Extract multiple sub-samples of data
get_species

Find matching species in a list of marine mammals
harbor_seal

Set of sensor lists for a harbor seal
m2h

Heading from accelerometer and magnetometer data
draw_axis

Draw time axis on plott plot.
fir_nodelay

Delay-free filtering
decdc

Reduce the sampling rate
find_dives

Find time cues for dives
dive_stats

Compute summary statistics for dives or flights
euler2rotmat

Make a rotation (or direction cosine) matrix
load_nc

Load a tag dataset from a netCDF file.
njerk

Compute the norm-jerk
interp_nan

Remove NAs from sensor data and return indices of (rows of) filled values
julian_day

Convert between dates and Julian day numbers.
lalo2llf

Convert latitude-longitude track points into a local level frame
norm2

Compute the row-wise vector norm
inv_axis

Identify invariant axis in triaxial movement measurements.
m_dist

Calculate Mahalanobis distance
make_info

Make an info structure with tag metadata
htrack

Simple horizontal dead-reckoned track
interp2length

Interpolate regularly sampled data to increase its sampling rate and match its length to another variable.
inclination

Estimate the inclination angle
median_filter

Computes the nth-order median filter
read_cats

Read a CATS data file and convert to .nc
read_cats_csv

Read a CSV file with sensor data from a CATS tag
metadata_editor

Edits a html file from given csv.
msa

Compute MSA
plott_static_panel

Helper function for plott
smooth

Low pass filter a time series
prh_predictor1

Predict the tag position on a diving animal from depth and acceleration data
sens_struct

Generate a sensor structure from a sensor data vector or matrix.
rotmat2euler

Decompose a rotation (or direction cosine) matrix
rotation_test

Carry out a rotation randomization test.
odba

Compute ODBA
rotate_vecs

Rotate triaxial vector measurements
mean_absorption

Calculate the mean absorption in salt water
ocdr

Estimate the forward speed
rotate_data

Rotate data.
save_nc

Save a tag dataset to a netCDF file.
plott_base

Plot tag data time series
make_specgram

Plot a spectrogram with default settings
image_irreg

Plot an image with an irregular grid.
rough_cal_3d

Estimate scale factors and offsets
plott

Plot tag data time series
merge_fields

Merge the fields of two lists
track3D

Reconstruct a track from pitch, heading and depth data, given a starting position
prh_predictor2

Predict the tag position on a diving animal from depth and acceleration data
undo_cal

Undo calibrations steps
tag2animal

Tag-frame to animal-frame conversion
ptrack

Estimate simple dead-reckoned track
spherical_cal

Deduce the calibration constants
speed_from_depth

Estimate the forward speed of a diving animal
sound_speed

Sound speed estimation
tortuosity

Measure tortuosity index
spectrum_level

Compute the spectrum level of a signal x.
zero_crossings

Find zero-crossings in a vector
absorption

Calculates the absorption coefficient for sound in seawater
a2pr

Pitch and roll from acceleration
apply_cal

Implement a calibration on tag sensor data
block_acf

Compute autocorrelation function
acc_wgs84

Calculate total acceleration
block_rms

Compute RMS of sample blocks
beaked_whale

Set of sensor lists for a beaked_whale
body_axes

Generate the cardinal axes of an animal
block_mean

Compute mean of sample blocks
add_nc

Save an item to a NetCDF or add one tag sensor or metadata variable to a NetCDF archive file.
crop

Interactive data cropping tool.
check_AM

Compute field intensity of tag acceleration and magnetometer data.
crop_to

Reduce the time span of data
crop_all

Reduce the time span of a dataset
cline

Add colored line segments to a plot
comp_filt

Complementary filtering of a signal.
csv2struct

Read tag metadata from csv
buffer

Buffers a signal vector into matrix
col_line3

Plot coloured line(s) in 3 dimensions with plot_ly