toy_activity_data {behavr} | R Documentation |
Generate toy activity and sleep data mimicking Drosophila behaviour in tubes
Description
This function generates random data that emulates some of the features of fruit fly activity and sleep. This is designed exclusively to provide material for examples and tests as it generates "realistic" datasets of arbitrary length.
Usage
toy_activity_data(metadata = NULL, seed = 1, rate_range = 1/c(60,
10), duration = days(5), sampling_period = 10, ...)
toy_ethoscope_data(...)
toy_dam_data(...)
Arguments
metadata |
data.frame where every row defines an individual.
Typically |
seed |
random seed used (see set.seed) |
rate_range |
parameter defining the boundaries of the rate at which animals wake up. It will be uniformly distributed between animals, but fixed within each animal. |
duration |
length (in seconds) of the data to generate |
sampling_period |
sampling period (in seconds) of the resulting data |
... |
additional arguments to be passed to |
Value
a behavr table with the metadata columns as metavariables.
In addition to id
and t
columns different methods will output different variables:
-
toy_activity_data
will haveasleep
andmoving
(1/10s) -
toy_dam_data
will haveactivity
(1/60s) -
toy_ethoscope_data
will havexy_dist_log10x1000
,has_interacted
andx
(2/1s)
References
The relevant rethomic tutorial section – explainig how to work with toy data.
See Also
-
behavr – to formally create a behavr object
Examples
# just one animal, no metadata needed
dt <- toy_ethoscope_data(duration = days(1))
# advanced, using a metadata
metadata <- data.frame(id = paste0("toy_experiment|",1:9),
condition = c("A", "B", "C"))
metadata
# Data that could come from the scopr package:
dt <- toy_ethoscope_data(metadata, duration = days(1))
print(dt)
# Some DAM-like data
dt <- toy_dam_data(metadata, seed = 2, duration = days(1))
print(dt)
# data where behaviour is annotated e.g. by a classifier
dt <- toy_activity_data(metadata, 1.5)
print(dt)