Title: | Analyse Animal Behaviours |
---|---|
Description: | What the package does (one paragraph). |
Authors: | Mikkel Roald-Arbøl [aut, cre] |
Maintainer: | Mikkel Roald-Arbøl <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.1.0 |
Built: | 2024-11-02 04:12:48 UTC |
Source: | https://github.com/roaldarbol/anibehavr |
Add logticks
add_logticks( base = 10, sides = "bl", scaled = TRUE, short = unit(0.1, "cm"), mid = unit(0.2, "cm"), long = unit(0.3, "cm"), colour = "black", size = 0.5, linetype = 1, alpha = 1, color = NULL, data = data.frame(x = NA), ... )
add_logticks( base = 10, sides = "bl", scaled = TRUE, short = unit(0.1, "cm"), mid = unit(0.2, "cm"), long = unit(0.3, "cm"), colour = "black", size = 0.5, linetype = 1, alpha = 1, color = NULL, data = data.frame(x = NA), ... )
base |
Base |
sides |
Sides |
scaled |
Scaled |
short |
Short |
mid |
Mid |
long |
Long |
colour |
Colour |
size |
Size |
linetype |
Linetype |
alpha |
Alpha |
color |
Color |
data |
Data |
... |
Other |
Added logticks
Assign video
assign_video(track_list, animal_ids, tracker = c("trex", "idtrackerai"))
assign_video(track_list, animal_ids, tracker = c("trex", "idtrackerai"))
track_list |
List from video files |
animal_ids |
Animal ids |
track_list
Classify states Across Time-scales
classify_states(data, movement_var, window_widths, .keep = FALSE)
classify_states(data, movement_var, window_widths, .keep = FALSE)
data |
Data frame |
movement_var |
Binary (1/0) variable to be used for the classification |
window_widths |
Window width for the filter |
.keep |
Keep both intermediate filter components (forward/backward) |
Data frame with classifications
Get an average of your data where the output is n rows (approximately).
data |
Data |
n_observations |
Number of observations in output data frame |
group |
grouping variable |
Smaller data frame where values are means of N observations
Get an average of your data where the output is n rows (approximately).
data |
Data |
vars |
Variables to mean |
n_observations |
Number of observations in output data frame |
group |
grouping variable |
Smaller data frame where values are means of N observations
Correct time
correct_time(data)
correct_time(data)
data |
A data frame where times are added.
csv_clean
csv_clean(df, tracker = c("trex", "idtrackerai"))
csv_clean(df, tracker = c("trex", "idtrackerai"))
df |
Raw TRex csv file |
df
Filter Classifications
filter_classifications(data, window_widths)
filter_classifications(data, window_widths)
data |
Data frame |
window_widths |
Minimum duration of bout |
Filtered data frame
Forward-backward Filter
filter_forward_backward(data, movement_var, window_width)
filter_forward_backward(data, movement_var, window_width)
data |
Data frame |
group |
Find position
find_position(df, exp_setup = c("wellplate", "tube"), animal_ids)
find_position(df, exp_setup = c("wellplate", "tube"), animal_ids)
df |
track_list of data frames. |
exp_setup |
Experimental setup, eith "wellplate " or "tube". |
animal_ids |
Vector of animal IDs, as strings. |
A single tibble
Generate bout numbers for binary variable
generete_state_numbers(data, var, .keep = FALSE)
generete_state_numbers(data, var, .keep = FALSE)
data |
Data frame |
var |
Variable name (in quotes) |
.keep |
Keep both intermediate filter components (forward/backward) |
Data frame with classifications
IDENTIFY PERIODS OF INTEREST
identify_periods(data, var, newvar, threshold = "minmax", as_factor = FALSE)
identify_periods(data, var, newvar, threshold = "minmax", as_factor = FALSE)
data |
Data frame |
var |
Variable to be identified |
newvar |
New variable name |
threshold |
Method for thresholding. Either "minmax", "mediansd" or a number. |
as_factor |
Whether an output should be returned as factor |
Thresholded data frame
Title
inf_remove(df)
inf_remove(df)
df |
Data frame |
A data frame without Inf values
inverse_ecdf
inverse_ecdf(data, col, min_length, rest_state = FALSE)
inverse_ecdf(data, col, min_length, rest_state = FALSE)
data |
A data frame (e.g. a tibble) |
col |
Variable to make the density function for. |
min_length |
Minimal starting duration in frames |
rest_state |
Whether to make the ecdf for resting or active periods. TRUE or FALSE (default) |
Inverse ECDF
is_moving
is_moving(df, type, n_frames = 50)
is_moving(df, type, n_frames = 50)
df |
Data frame. |
type |
Use mean or median. |
n_frames |
Number of frames used to generate rolling average. |
Data frame with a value for whether the animal is moving
Ensure that grouping levels match across data frames - add an error/warning if not.
join_timeseries( .x, y, by = NULL, group = NULL, method = NA, copy = FALSE, suffix = c("", ".y"), keep = NULL )
join_timeseries( .x, y, by = NULL, group = NULL, method = NA, copy = FALSE, suffix = c("", ".y"), keep = NULL )
Merges data sets for consecutive videos for each animal.
merge_videos(df_list)
merge_videos(df_list)
df_list |
List of data frames |
Merged data frame from list
Min-max normalisation
min_max_norm(x)
min_max_norm(x)
x |
Normalisation
Non-numeric mode
mode_nonnumeric(x)
mode_nonnumeric(x)
x |
Vector to find the mode over |
Mode
Title
read_align_all_data(filenames, bin_seconds)
read_align_all_data(filenames, bin_seconds)
filenames |
Filenames |
bin_seconds |
Bin duration in seconds |
Aligned data frame
Title
read_align_data(data, bin_seconds, time, animal_id)
read_align_data(data, bin_seconds, time, animal_id)
bin_seconds |
Bin duration in seconds |
filename |
Filenames |
Aligned data frame
Title
read_switch_data(filenames, bin_seconds, time_radius = FALSE)
read_switch_data(filenames, bin_seconds, time_radius = FALSE)
filenames |
Filenames |
bin_seconds |
Bin duration in seconds |
time_radius |
Radius around change |
Switch data
Subset Around Event
subset_around_event(data, var, from, time_var, time_radius = FALSE)
subset_around_event(data, var, from, time_var, time_radius = FALSE)
data |
Data frame |
var |
Variable to center around |
from |
Reference point (e.g. "Day"/"Night") |
time_var |
Which variable represents time |
time_radius |
Time around point |
Subset of data frame around point in time
Sync time
sync_time(.data, data2, x, y)
sync_time(.data, data2, x, y)
.data |
Data frame or tibble |
data2 |
The second data frame |
x |
Parameter used to merge (often time) |
y |
Variable to be synced along with x |
Tibble