behavr (version 0.3.1)

toy_activity_data: 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 metadata has, at least, the column id. The default value (NULL), will generate data for a single animal.

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 simulate_animal_activity

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 have asleep and moving (1/10s)

  • toy_dam_data will have activity (1/60s)

  • toy_ethoscope_data will have xy_dist_log10x1000, has_interacted and x (2/1s)

References

See Also

  • behavr -- to formally create a behavr object

Examples

Run this code
# NOT RUN {
# 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)
# }

Run the code above in your browser using DataLab