Package 'edfReader'

Title: Reading EDF(+) and BDF(+) Files
Description: Reads European Data Format files EDF and EDF+, see <http://www.edfplus.info>, BioSemi Data Format files BDF, see <http://www.biosemi.com/faq/file_format.htm>, and BDF+ files, see <http://www.teuniz.net/edfbrowser/bdfplus%20format%20description.html>. The files are read in two steps: first the header is read and then the signals (using the header object as a parameter).
Authors: Jan Vis [aut, cre]
Maintainer: Jan Vis <[email protected]>
License: GPL-3
Version: 1.2.1
Built: 2024-06-29 05:49:58 UTC
Source: CRAN

Help Index


edfReader: A package for reading EDF(+) and BDF(+) files

Description

The edfReader package reads EDF(+) and BDF(+) files in two steps: first the header is read and then the signals (using the header object as an parameter).

edfReader functions

readEdfHeader ⁠ ⁠ to read the file header with basic info about the signals
readEdfSignals to read one or more recorded signals

The objects returned by these functions are described in the package vignette.

Details

Package ⁠ ⁠ edfReader
Version 1.2
Date March 3, 2018
Licence GPL version 3 or newer
GitHub https://github.com/Pisca46/edfReader
Author Jan Vis, Vis Consultancy
E-mail [email protected]
Web visconsultancy.eu

Acknowledgement

This package has used code from:

  • edf.R version 0.3 (27-11-2013) from Fabien Feschet, http://data-auvergne.fr/cloud/index.php/s/WYmFEDZylFWJzNs

  • the work of Henelius Andreas as of July 2015, https://github.com/bwrc/edf

See Also

For the vignette use the console command:
vignette('edfReaderVignette', package = "edfReader")
or click on Index below.


Read EDF(+) or BDF(+) file header

Description

The function reads the header of an EDF (European Data Format) file, an EDF+ file, an BDF file, or an BDF+ file

Usage

readEdfHeader(fileName)

Arguments

fileName

The full path to the EDF(+)/BDF(+) file to be read.

Value

an object of class ebdfHeader

Details

The object returned contains also an object of class ebdfSHeaders. Both objects ebdfHeader and ebdfSHeaders have supporting S3 print and summary functions.
For object details see the package vignette.

Acknowledgement

This package has used code from:

  • edf.R version 0.3 (27-11-2013), http://feschet.fr/?p=11

  • the work of Henelius Andreas as of July 2015, https://github.com/bwrc/edf

See Also

edfReader, readEdfSignals
For the vignette use the console command:
vignette('edfReaderVignette', package = "edfReader")
or click on Index below.

Examples

# Examples from the vignette
libDir <- system.file ("extdata", package="edfReader")
# a continuous recording
CFile <- paste (libDir, '/edfPlusC.edf', sep='')
CHdr  <- readEdfHeader (CFile)
CHdr                   # print the header
summary (CHdr)         # print a header summary
str (CHdr)             # look to the details
CHdr$sHeaders          # print the signal headers
summary(CHdr$sHeaders) # print a signal headers summary
str(CHdr$sHeaders)     # look to the signal header details
# for a discontinuous recording
DFile <- paste (libDir, '/bdfPlusD.bdf', sep='')
# and proceed as above to read the header and to show the results

Reads signals from an EDF(+)/BDF(+) file

Description

The function reads ordinary or annotation signals from an EDF(+)/BDF(+) file.

Usage

readEdfSignals(hdr, signals = "All", from = 0, till = Inf,
  physical = TRUE, fragments = FALSE, recordStarts = FALSE,
  mergeASignals = TRUE, simplify = TRUE)

Arguments

hdr

An ebdfHeader object read with the readEdfHeader() function.

signals

a vector with one or more of the following signal designations: 'All' (default), to include all signals; 'Ordinary', to include all ordinary signals; 'Annotations', to include all annotation signals; signal labels and/or signal names; or signal numbers (numeric or as character).

from

numeric, the time in seconds from which the signals shall be read.

till

numeric, the time in seconds till which the signals shall be read. The value may exceed the total duration of the recoding.

physical

logical, if TRUE (the default) digital samples values are mapped to their physical values, If not, the digital values are returned.

fragments

logical, if TRUE discontinuously recorded signals are stored as a list of continuous fragments. If FALSE (the default), a signal is stored as one numeric vector with NA values filling the gaps.

recordStarts

logical, if TRUE a data frame with the empty annotations with the data record start time will be included. If FALSE (the default), not.

mergeASignals

logical, if TRUE all annotations will be merged into one data frame. If FALSE there will be one data frame per annotation signal.

simplify

logical, if TRUE and if there is only one signal read, the signal itself is returned (in stead of a list with that signal as the only one element). If FALSE, this simplification is not performed.

Details

For ordinary signals the from and till parameters are interpreted as [from, till). For annotation signals from-till has to overlap the onset-(onset+duration) period. For for details see the package vignette.

Value

Either a list of one or more signals or a single signal.
The list of signals returned is of class ebdfSignals and a single signal object is of one of the following classes:

  • ebdfASignal, for an annotation signal

  • ebdfFSignal, for a fragmented ordinary signal

  • ebdfCSignal, for a continuous ordinary signal (possible supplemented with NA values)

All classes have supporting print and summary functions. For object details see the package vignette.

Acknowledgement

This package has used code from:

  • edf.R version 0.3 (27-11-2013), http://feschet.fr/?p=11

  • the work of Henelius Andreas as of July 2015, https://github.com/bwrc/edf

See Also

edfReader, readEdfHeader
For the vignette use the console command:
vignette('edfReaderVignette', package = "edfReader")
or click on Index below.

Examples

# Examples from the vignette
libDir <- system.file ("extdata", package="edfReader")
# a continuous recording
CFile <- paste (libDir, '/edfPlusC.edf', sep='')
CHdr  <- readEdfHeader (CFile)
CSignals <- readEdfSignals (CHdr)            # to read all signals
# read 3 differently designated signals from 5.1 till 18 seconds period
someCSignalsPeriod <- readEdfSignals (CHdr, signals=c(3, "5", "sine 8.5 Hz"), from=5.1, till=18)
someCSignalsPeriod                           # print the signals
summary(someCSignalsPeriod)                  # print singals summary
someCSignalsPeriod$`sine 8.5 Hz`             # print the `sine 8.5 Hz` signal
summary(someCSignalsPeriod$`sine 8.5 Hz`)    # print a `sine 8.5 Hz` signal summary
str(CSignals$`sine 8.5 Hz`)                  # look to the details
# a discontinuous recording
DFile <- paste (libDir, '/edfPlusD.edf', sep='')
DHdr  <- readEdfHeader (DFile)
DSignals <- readEdfSignals (DHdr, fragments=TRUE)    # to read all signals
DSignals$`sine 8.5 Hz`                       # print fragmented signal
summary (DSignals$`sine 8.5 Hz`)             # print fragmented signal summary
str(DSignals$`sine 8.5 Hz`)                  # look to the details