splice_physio: Function to splice an ep.physio object to a section...

View source: R/physio_functions.R

splice_physioR Documentation

Function to splice an ep.physio object to a section demarcated by start and end codes.

Description

Function to splice an ep.physio object to a section demarcated by start and end codes.

Usage

splice_physio(
  ep.physio,
  start_code = NULL,
  end_code = NULL,
  other_codes = NULL,
  strict = TRUE
)

Arguments

ep.physio

An ep.physio object that already contains the $ttl_codes field

start_code

The onset TTL code that should be used for the start of splicing

end_code

The offset TTL code that should be used to end the splice

other_codes

an optional vector of other codes that are allowed between start_code and end_code.

strict

a boolean indicating whether the function should throw an error if TTL codes are found within the splice that are not contained in other_codes

Examples

## Not run: 
   #acq_data is an object read in by read_acq and then augmented by
   acq_data <- read_acq("~/Downloads/s3_ALL_data_prototype/070_SK_Physio.acq",
     acq2hdf5_location = "~/Library/Python/3.7/bin/acq2hdf5")[[1]]

   #read in a codes data.frame into codes
   acq_data <- augment_ttl_details(acq_data, zero_code = 4, code_labels_df=codes)

   #look for physio data between codes 6 and 28, allowing 12, 14, 20, 22 in between
   acq_data_reduce <- splice_physio(acq_data, start_code=6, end_code=28, other_codes=c(12, 14, 20, 22))

## End(Not run)

PennStateDEPENdLab/experiment_pipeline documentation built on Nov. 27, 2024, 4:56 a.m.