library(fgu.avoidance) library(dplyr) filepath <- "../example-data/three-animals.CSV" obj <- load_data(filepath) obj <- add_areas(obj) obj <- obj$animal_14 knitr::opts_chunk$set(echo = FALSE)
Due to the issues with the software, it is necessary to redefine the number of crosses slightly differently. The main issue is the animal "peeking" out into the zone but not actually visiting it. We then end up with much higher number of crosses than intended. The way to circumwent this is to set a central zone in which the "cross" doesn't count. This is how the Arena then looks
plt <- ggplot() + geom_box_room(fill = "grey20", alpha = 0.3) + geom_central_zone(fill = "red", alpha = 0.2) + theme_void() # Add some text?? plt
The zone in the middle is the "noman's zone", where the cross doesn't count as a cross. The animal needs to cross from either of the grey areas to count as a cross.
The following tracks are therefore considered crosses:
cross_left_right <- get_area_visits(obj$position, "left", from="right", between_allowed = 1) cross_right_left <- get_area_visits(obj$position, "right", from="left", between_allowed = 1) plot_crosses(obj, union(cross_left_right, cross_right_left))
Whereas these tracks would not be counted as middle crosses, although they might cross the midline
cross_left_central <- get_area_visits(obj$position, "left", from="central", between_allowed = 1) cross_only_left <- setdiff(cross_left_central, cross_left_right) cross_right_central <- get_area_visits(obj$position, "right", from="central", between_allowed = 1) cross_only_right <- setdiff(cross_right_central, cross_right_left) plot_crosses(obj, union(cross_only_left, cross_only_right))
The weird plotting - eg. the seemingly overalapping tracks in the top and the track in the bottom which eventually crosses to the left are due to the plotting, not calculation (I am plotting approx 1s around the cross, therefore if the mouse crosses the boundary multiple times, final lines are overlapping. Same goes for the eventual cross, which is due to a single there and back movement and then eventual cross to the other side - same track (here in pink) can be seen in the lime green in the graph above)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.