load_dam {damr} | R Documentation |
Load DAMS data from one or several continuous text files
Description
Uses "linked metadata" to load data from either single beam (DAM2) or multibeam (DAM5) arrays.
Usage
load_dam(metadata, date_format = "%d %b %y", FUN = NULL, ...)
Arguments
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 |
Details
The linked metadata should be generated using link_dam_metadata.
Value
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
References
-
damr tutorial – how to use this function in practice
See Also
-
behavr::behavr – the class of the resulting object
-
read_dam_file – to load data from a single file (without metadata)
Examples
# 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)