Type: Package
Title: Read Data from European Data Format (EDF and EDF+) Files
Version: 1.0.0
Description: Import physiologic data stored in the European Data Format (EDF and EDF+) into R. Both EDF and EDF+ files are supported. Discontinuous EDF+ files are not yet supported.
Author: Andreas Henelius <andreas.henelius@iki.fi>
Maintainer: Andreas Henelius <andreas.henelius@iki.fi>
URL: https://github.com/bwrc/edf
Depends: R (≥ 3.0.2)
License: MIT + file LICENSE
Encoding: UTF-8
RoxygenNote: 5.0.1
NeedsCompilation: no
Packaged: 2016-04-22 06:58:47 UTC; anhe
Repository: CRAN
Date/Publication: 2016-04-22 13:09:51

Read data stored in a European Data Format (EDF and EDF+) file.

Description

The edf package provides methods for reading files containing physiologic data stored in a European Data Format (EDF and EDF+) file and returns the data as a structured list.

References

Kemp B., Värri, A., Rosa, A.C., Nielsen, K.D. and Gade, J. (1992). A simple format for exchange of digitized polygraphic recordings. Electroencephalogr Clin Neurophysiol. 1992 May;82(5):391-3. http://www.ncbi.nlm.nih.gov/pubmed/1374708

Kemp, B. and Olivan, J. (2003). European data format 'plus' (EDF+), an EDF alike standard format for the exchange of physiological data. Clin Neurophysiol. 2003 Sep;114(9):1755-61. http://www.ncbi.nlm.nih.gov/pubmed/12948806


Create variable name from string.

Description

This function creates a sensible variable name by replacing all non-alphanumeric characters with underscores. This is useful when the string is to be used as a the name of a list element.

Usage

create.variable.name(s)

Arguments

s

The string to be used as a variable name

Value

The string with non-alphanumeric characters replaced by underscores

Examples

s <- "a-b"
edf:::create.variable.name(s)

Convert string to a numeric.

Description

This function removes spaces from a string and converts it to a numeric. This is required when reading EDF data, since the data fields in the header are of fixed size, and extra whitespace must hence be trimmed.

Usage

edf.char.to.num(s)

Arguments

s

The string to be converted

Value

A numeric.

Examples

s <- "123   "
edf:::edf.char.to.num(s)

Parse the annotation data in an EDF+ file.

Description

This function parses the annotations in an EDF+ file.

Usage

parse.edf.annotations(data)

Arguments

data

The data containining the annotations (as 8-bit unsigned integers).

Value

A data frame containing the annotatations in the EDF+ file.


#' Parse the global header of a European Data Format (EDF and EDF+) file.

Description

This function parses the header of an EDF or EDF+ file.

Usage

parse.edf.global.header(data)

Arguments

data

The 256 bytes of raw data that contain the EDF/EDF+ header.

Value

A named list containing the information in the EDF/EDF+ header.


Parse the signal header of a European Data Format (EDF and EDF+) file.

Description

This function parses the signal header of an EDF or EDF+ file.

Usage

parse.edf.signal.header(data, header.global)

Arguments

data

The n*256 bytes of raw data that contain the EDF/EDF+ signal header,

header.global

The global EDF/EDF+ header. #' where n is the number of signals in the EDF/EDF+ file.

Value

A named list containing the information in the EDF/EDF+ signal header.


Parse one EDF+ Time-stamped Annotation List (TAL).

Description

This function parses one EDF+ Time-stamped Annotation List (TAL).

Usage

parse.event(data)

Arguments

data

The bytes of raw data that contain the TAL.

Value

A data frame containing the information in the TAL: onset, duration and annotation.


Read a European Data Format (EDF and EDF+) file.

Description

This function reads the data stored in an EDF or EDF+ file. This data consists of, e.g., physiologic signals and possibly also annotations (EDF+ files only).

Usage

read.edf(filename, read.annotations = TRUE, header.only = FALSE)

Arguments

filename

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

read.annotations

Boolean denoting whether or not annotations should be read, if they are present. Defaults is TRUE.

header.only

Boolean denoting whether to only read the headers in the EDF file. Default is FALSE. #' @return A list containing

  1. the global header (recording start date, duration etc).

  2. the signal headers (transducer types, sampling rates etc).

  3. the signal data

  4. the events (annotations). This is always NA for EDF files. This is NA for EDF+ files without annotations.

References

Kemp B., V\"arri, A., Rosa, A.C., Nielsen, K.D. and Gade, J. (1992). A simple format for exchange of digitized polygraphic recordings. Electroencephalogr Clin Neurophysiol. 1992 May;82(5):391-3. http://www.ncbi.nlm.nih.gov/pubmed/1374708

Kemp, B. and Olivan, J. (2003). European data format 'plus' (EDF+), an EDF alike standard format for the exchange of physiological data. Clin Neurophysiol. 2003 Sep;114(9):1755-61. http://www.ncbi.nlm.nih.gov/pubmed/12948806


Remove trailing whitespace from a string.

Description

This function removes trailing whitespace from a string. This is required when reading EDF data, since the data fields in the header are of fixed size, and extra whitespace must hence be trimmed.

Usage

trim.end(s)

Arguments

s

The string to be converted

Value

The string gives as input without trailing whitespace

Examples

s <- "abc   "
edf:::trim.end(s)