mutate_soc: Conveniently add common new variables to the 'soc' table.

Description Usage Arguments Details Overview of functions See Also

Description

These functions are designed for use within summarise_, and will compute common parameters for pairs of animals. By default, these functions will use the expected variable names, as are default in tracks objects, but they can be overridden.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
pair_dist(x1 = X1, y1 = Y1, x2 = X2, y2 = Y2)

nip_dist(x1 = X1, y1 = Y1, x2 = X2, y2 = Y2,
  minor_axis1 = minor_axis1, minor_axis2 = minor_axis2,
  major_axis1 = major_axis1, major_axis2 = major_axis2,
  orientation1 = orientation1, orientation2 = orientation2, n = 20)

orientation_diff(orientation1 = orientation1, orientation2 = orientation2)

heading_diff(heading1 = heading1, heading2 = heading2)

heading_diff2(x1 = X1, y1 = Y1, x2 = X2, y2 = Y2, order_by = frame)

leader(x1 = X1, y1 = Y1, x2 = X2, y2 = Y2, order_by = frame)

Arguments

x1

X-coordinate for animal 1.

y1

Y-coordinate for animal 1.

x2

X-coordinate for animal 2.

y2

Y-coordinate for animal 2.

minor_axis1

Minor axis (*b*) of the ellipse fit of animal 1.

minor_axis2

Minor axis (*b*) of the ellipse fit of animal 2.

major_axis1

Major axis (*a*) of the ellipse fit of animal 1.

major_axis2

Major axis (*a*) of the ellipse fit of animal 2.

orientation1

Angle of ellipse fit with the x-axis for animal 1.

orientation2

Angle of ellipse fit with the x-axis for animal 2.

n

Number of point used for numerical approximation.

heading1

Angle animal 1 is heading based on previous and current coordinates.

heading2

Angle animal 2 is heading based on previous and current coordinates.

order_by

Used for making sure only subsequent frames are used for time dependent calculations. You probably want to leave this at default.

Details

These functions typically rely on parameters that originate from the tr table, such as X1 or orientation2. If so, that means you have to add those variable to the soc table first, by calling join_tr_to_soc.

Overview of functions

The following functions are currently available for easy use in calls to mutate.

pair_dist

Calculates the distance between the centroids of animal1 and animal2. You need to make x and y coordinates available.

nip_dist

When ellipse fits are available, calculates the distance from the front of the ellipse of animal1 (presumably the head or mouth) and the closest point on the ellipse of animal2. This function uses a numerical approximation based on n points along the ellipse of animal2. You need to make x and y coordinates, orientations, and minor and major axis sizes available.

orientation_diff

Difference in orientations. You need to make orientations available.

heading_diff

Difference in headings. Calculate heading for each animal first (using mutate(tracks, heading = heading())), then add the heading to the soc table (using join_tr_to_soc(tracks, heading)). Use heading_diff2 when basing it off x and y coordinates. You need to make headings available.

heading_diff2

Difference in headings, based on x and y coordinates. You need to make x and y coordinates available.

leader

Find whether animal1 is in front (TRUE), or in behind (FALSE) of animal 2, based on their mean heading. You need to make x and y coordinates available.

See Also

mutate_tr mutate_.tracks


Ax3man/trackr documentation built on Oct. 8, 2019, 10:53 p.m.