Learn R Programming

damr (version 0.3.7)

link_dam_metadata: Link DAM2 or DAM5 metadata to result files

Description

This function checks and add columns to DAMS metadata. This way, it can subsequently be loaded (via load_dam).

Usage

link_dam_metadata(x, result_dir)

Arguments

x

object such as a data.frame, or the name of a file (see detail)

result_dir

the root directory where all daily data are saved

Value

a data.table::data.table with the same rows as x, and extra columns used for further data loading

Details

These function will augment metadata from two different types of inputs:

  1. A data.frame (recommended) In this case, the function will try to match requested data with data available on result_dir. The provided data.frame or data.table has typically one row per requested individual and the columns (not necessarily in this order):

    • file -- the name of a data file (e.g. "Monitor3.txt"), it has to exists in result_dir.

    • start_datetime -- the first day and time of the requested experiment (e.g. "2014-12-28 18:00:00").

    • stop_datetime -- the last day and time of the requested experiment (e.g. "2014-12-30 19:00:00" or simply "2014-12-30").

    • region_id -- the channel (between 1 and 32) in which the animal was in (e.g. 20). region_id is optional. If not provided, all 32 channels are loaded with the same conditions.

    • ??? any number of arbitrary columns to associate conditions/treatments/genotypes/... to the previous columns.

  2. The name of a CSV file that contains a table as described in 1.

The time in data is expressed relatively to start_date. In other words, if you do circadian analysis, and your D -> L transitions are at 09:00:00, you want to set start_datetime = "YYY-MM-DD 09:00:00". The result_directory`` is the folder conraining all result (.txt) files (for instance, result_dir = "C:/where/I/Store/my/txt/files/"`)

References

See Also

  • load_dam -- to subsequently load the actual data