Skip to contents

Creating and converting anipoint objects

Functions that create an anipoint (the position-grain frame), coerce other objects to anipoint, or provide example data. aniframe is the abstract parent class shared by anipoint and anievent.

as_anipoint()
Convert a data frame to anipoint
anipoint()
Create an anipoint data frame
example_anipoint()
Create example anipoint data
is_anipoint()
Check if object is an anipoint
ensure_is_anipoint()
Ensure object is an anipoint
is_aniframe()
Check if object is an aniframe
ensure_is_aniframe()
Ensure object is an aniframe
validate_anipoint()
Validate an anipoint
aniframe() as_aniframe() example_aniframe() validate_aniframe() deprecated
Deprecated aniframe constructors

Creating and converting anievent objects

Functions that create an anievent (long-format behavioural event records) or coerce other objects to anievent.

to_anievent()
Encode per-frame data into an anievent
as_anievent()
Cast a data frame to an anievent
anievent()
Create an anievent data frame
is_anievent()
Check if object is an anievent
ensure_is_anievent()
Ensure object is an anievent
validate_anievent()
Validate an anievent

Metadata

Read and declare metadata. set_* only declares; it never changes a value.

get_metadata()
Get metadata
set_metadata()
Set metadata
list_default_metadata()
Default metadata structure
print(<aniframe_metadata>)
Print the metadata of a frame
get_sampling_interval()
The interval between consecutive observations
is_sampling_regular()
Is the frame regularly sampled?
get_axis_directions()
Get the direction each axis points
set_axis_directions()
Say which way an axis points
get_angle_direction()
Which way angles run
get_handedness()
Whether the frame is right- or left-handed
get_coordinate_system()
The coordinate system an anipoint is in

Declaring variables

Declare which columns carry identity, time, position and events. The setters restructure the frame to match, so set_metadata() refuses these fields.

get_variables() set_variables() add_variables() remove_variables()
Read and declare which columns carry identity, time, position and events
get_keys()
The grouping columns of a frame
get_index()
The column an anipoint is indexed by
set_index()
Declare which column an anipoint is indexed by
get_axes()
The axis roles of an anipoint, and the columns carrying them

Transforming values

Functions that change values and update the metadata to match.

convert_unit_space()
Convert the spatial unit of an anipoint
convert_unit_time()
Convert the time unit of an anipoint or anievent
convert_unit_angle()
Convert the angular unit of an anipoint
reflect_axis()
Turn an axis over

Structures

Points, the segments between them, and joints, over the levels of an identity or temporal variable. A frame can hold several named structures.

anistructure() experimental
Create a structure: points, the segments between them, and joints
print(<anistructure>) format(<anistructure>)
Print a structure
example_structure()
An example structure for the keypoints of example_anipoint()
validate_anistructure() experimental
Check that a structure is internally consistent
is_anistructure() ensure_is_anistructure()
Test whether an object is an anistructure
set_structure() get_structure() remove_structure() experimental
Attach, read and remove the structures of a frame

Segments

The same data re-expressed per segment: a length and a unit direction, converted from and back to an anipoint.

as_anisegment() experimental
Convert an anipoint to segments: a length and a direction per segment
is_anisegment() ensure_is_anisegment()
Test whether an object is an anisegment

Joints

One angle per joint, computed from its two segments.

as_anijoint() experimental
Convert segments to joints: one angle per joint
is_anijoint() ensure_is_anijoint()
Test whether an object is an anijoint

Spatial checks

These functions provide checks for your coordinate system. is_spatial() and ensure_is_spatial() check that the declared position columns are present and numeric; the is_cartesian*() family reports which coordinate system the frame is in, which follows from the axis roles it declares.

is_spatial()
Test whether the spatial columns match the metadata
ensure_is_spatial()
Ensure the spatial columns match the metadata
is_cartesian()
Test whether an anipoint uses a Cartesian coordinate system
is_cartesian_1d()
Test for a 1-D Cartesian coordinate system
is_cartesian_2d()
Test for a 2-D Cartesian coordinate system
is_cartesian_3d()
Test for a 3-D Cartesian coordinate system
is_polar()
Test whether an anipoint uses a polar coordinate system
is_cylindrical()
Test whether an anipoint uses a cylindrical coordinate system
is_spherical()
Test whether an anipoint uses a spherical coordinate system
ensure_is_cartesian()
Internal guard for Cartesian checks
ensure_is_cartesian_1d()
Internal guard for 1-D Cartesian checks
ensure_is_cartesian_2d()
Internal guard for 2-D Cartesian checks
ensure_is_cartesian_3d()
Internal guard for 3-D Cartesian checks
ensure_is_polar()
Internal guard for polar checks
ensure_is_cylindrical()
Internal guard for cylindrical checks
ensure_is_spherical()
Internal guard for spherical checks

Angles

Two families, and the difference matters. *_angle() and the x_to_y() conversions manipulate how an angle is written. The circ_*() functions compute with the wraparound: an ordinary mean or median of angles gives the wrong answer, since the mean of 350 and 10 degrees is 0, not 180.

Handling angles

rad_to_deg()
Convert radians to degrees
deg_to_rad()
Convert degrees to radians
angle_to_rad() angle_from_rad()
Convert angles between radians and a frame's angular unit
wrap_angle()
Constrain angles to a standard range
unwrap_angle()
Remove wrapping from a sequence of angles
angle_between()
The angle between two vectors

Circular statistics

circ_difference()
Shortest signed distance between two angles
circ_successive_difference()
Differences between successive angles in a series
circ_mean()
Circular mean
circ_median()
Circular median
circ_sd()
Circular standard deviation
circ_mad()
Circular median absolute deviation

Helpers

convert_nan_to_na()
Convert NaN to NA in numeric columns
convert_inf_to_na()
Convert Inf to NA in numeric columns