Description Usage Arguments Details Value References See Also Examples
View source: R/load-ethoscope.R
This function is used to import behavioural data generated
by the ethoscope platform.
That is it loads multiple .db
files into a single R
behavr::behavr table.
1 2 3 |
metadata |
data.table::data.table used to load data (see detail) |
min_time, max_time |
load only data between |
reference_hour |
hour, in the day, to use as ZT0 reference. When unspecified, time will be relative to the start of the experiment. |
verbose |
whether to print progress (a logical) |
columns |
optional vector of columns to be selected from the db file.
Time (t) is always implicitly selected.
When |
cache |
the name of a local directory to cache results for faster subsequent data loading. |
ncores |
number of cores to use for optional parallel processing (experimental). |
FUN |
function (optional) to transform the data from each individual immediately after is has been loaded. |
... |
extra arguments to be passed to |
the linked metadata should be generated using link_ethoscope_metadata.
A behavr table. In addition to the metadata, it contains the data, with the columns:
id
– autogenerated unique identifier, one per animal
t
– time (s)
Several variables recorded by ethoscopes (position, angle, width/height and others), or computed by FUN
.
Distance units (e.g. xy position, height/width) are expressed as a fraction of the width of the ROI they originate from.
behavr tutorial – how to work with the obtained behavr table
behavr::behavr – to understand the output format
experiment_info – to show information about a file/experiment
list_result_files – to list available files
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | dir <- paste0(scopr_example_dir(), "/ethoscope_results/")
data(region_id_metadata)
metadata <- link_ethoscope_metadata(region_id_metadata, dir)
print(metadata)
# Default data loading
dt <- load_ethoscope(metadata)
dt
# We use reference hour to set zt0 to 09:00 GMT
dt <- load_ethoscope(metadata, reference_hour=9)
dt
# Only load x and y positions
dt <- load_ethoscope(metadata, columns=c("x", "y"), reference_hour=9)
dt
# apply function whilst loading the data
dt <- load_ethoscope(metadata, reference_hour=9, FUN=head)
dt
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.