loadStartleData: Load Startle Data

Description Usage Arguments Value Examples

View source: R/startle.r

Description

This function is used for loading and processing all data related to startle experiments. All data generated with PASTA, Platform for Acoustic STArle experiments, should be placed in a single folder. Navigate to this folder, set it as working directory, and call this function. All data will be loaded, processed and assigned to a chosen variable that can be passed on other functions.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
loadStartleData(
  auto_import = TRUE,
  data,
  mass,
  addhead,
  addtail,
  metadata,
  correction = TRUE,
  synchronise = FALSE
)

Arguments

auto_import

An argument with default value TRUE. If set to TRUE it will load all .pasta files from the working directory and merge them apropriately. If set to FALSE, a user must specify group_names.

data

An argument used only if auto_import = FALSE. A list. A list containing data frames with data from .pasta files.

mass

An argument used only if auto_import = FALSE. A dataframe, in first column are names of animals, second their mass. Names in first column must correspond to the names of the elements in list used as an data argument.

addhead

Optional argument. Adds a number of seconds to the duration of the impulse. Acounts for the lag of the animal.

addtail

Optional argument. Adds a number of seconds to the duration of the impulse. Acounts for the lag of the animal.

metadata

Optional argument. For a custom made pulse protocol.

correction

Argument with default value TRUE. If set to TRUE, values will be corrected for the animal mass.

synchronise

Argument with default value FALSE. If set to TRUE, timestamps will be corrected based on the synchroniseTime.csv in the working directory.

Value

A dataframe with all startle data

Examples

1
2
3
4
5
6
7
8
9
# Creating random experiment data
data <- list("CTR 1" = data.frame(x = seq(1, 210881, by=12), y = runif(17574, min=-30, max=30)),
             "CTR 2" = data.frame(x = seq(1, 210881, by=12), y = runif(17574, min=-30, max=30)),
             "EXP 1" = data.frame(x = seq(1, 210881, by=12), y = runif(17574, min=-30, max=30)),
             "EXP 2" = data.frame(x = seq(1, 210881, by=12), y = runif(17574, min=-30, max=30)))
mass <- data.frame("group" = c("CTR 1", "CTR 2", "EXP 1", "EXP 2"), "mass" = c(300, 350, 280, 330))

# Running an example of loadStartleData with auto_import set to FALSE
df <- loadStartleData(auto_import=FALSE, data = data, mass = mass, addhead=0.1, addtail=1)

ratPASTA documentation built on June 2, 2021, 9:06 a.m.