eeg_segment: Segment (and unsegment) an eeg_lst.

View source: R/segmentation.R

eeg_segmentR Documentation

Segment (and unsegment) an eeg_lst.

Description

  • eeg_segment() subdivides of the EEG into different segments or epochs. (Fieldtrip calls the segment "trials".) The limits of segment are inclusive: If, for example, lim = c(0,0), the segment would contain only sample 1.

Usage

eeg_segment(.data, ..., .lim = c(-0.5, 0.5), .end, .unit = "s")

eeg_unsegment(
  .data,
  .start = 1,
  .sep = c(.type = "New Segment", .description = ""),
  .zero = c(.type = "Time 0", .description = "")
)

Arguments

.data

An eeg_lst object.

...

Description of the event.

.lim

Vector indicating the time before and after the event. Or dataframe with two columns, with nrow=total number of segments

.end

Description of the event that indicates the end of the segment, if this is used, .lim is ignored.

.unit

"seconds" (or "s"), "milliseconds" (or "ms"), or samples.

.start

Initial sample when an object is unsegmented

.sep

Segment separation marker. By default: .type == "New Segment"

.zero

Time zero marker. By default: .type == "Time 0"

Details

  • eeg_unsegment() does not reverse the segmentation, it simply concatenates all segments creating one object with only one segment.

When there is no segmentation, the eeg_lst contain one segment.

Value

An eeg_lst.

See Also

Other preprocessing functions: eeg_baseline(), eeg_downsample(), eeg_ica_keep(), eeg_ica(), eeg_rereference(), filt

Examples


# Segments 500ms before and 1000ms after the triggers s70 and s71
data_faces_10_trials %>% eeg_segment(.description %in% c("s70", "s71"),
  .lim = c(-5, 1)
)

# Segments 500ms before and  after the triggers all the triggers (which start with s)
data_faces_10_trials %>% eeg_segment(startsWith(.description, "s"))

bnicenboim/eeguana documentation built on March 16, 2024, 7:21 a.m.