load_dam | R Documentation |
Uses "linked metadata" to load data from either single beam (DAM2) or multibeam (DAM5) arrays.
load_dam(metadata, date_format = "%d %b %y", FUN = NULL, ...)
metadata |
data.table::data.table used to load data (see detail) |
date_format |
How dates are formatted in the DAM result files (see read_dam_file) |
FUN |
function (optional) to transform the data from each animal immediately after is has been loaded. |
... |
extra arguments to be passed to |
The linked metadata should be generated using link_dam_metadata.
A behavr::behavr table. In addition to the metadata, it contains the data, whith the columns:
id
– autogenerated unique identifier, one per animal
t
– time
activity
– number of beam crosses
damr tutorial – how to use this function in practice
behavr::behavr – the class of the resulting object
read_dam_file – to load data from a single file (without metadata)
# This is where our toy data lives
root_dir <- damr_example_dir()
# Metadata already made for us.
# It defines condition and genotype of each animal
data(single_file_metadata)
print(single_file_metadata)
# Linking:
metadata <- link_dam_metadata(single_file_metadata, root_dir)
# We find and load the matching data
dt <- load_dam(metadata)
print(dt)
# An example of the use of FUN,
# we load only the first few reads by run `head()` on each animal,
# on the fly (no pun intended)
dt <- load_dam(metadata, FUN = head)
print(dt)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.