Learn R Programming

damr (version 0.3.7)

load_dam: 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 FUN

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

Details

The linked metadata should be generated using link_dam_metadata.

References

See Also

Examples

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

Run the code above in your browser using DataLab