knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)

easyRecg

easyRecg is designed to host simple tools to facilitate reading and writing digital ECG files.

Installation

You can install the development version of easyRecg from GitHub with:

# install.packages("devtools")
devtools::install_github("rickeycarter/easyRecg")
library(easyRecg)
library(tibble)
devtools::load_all(".")
library(tibble)

Retrieving 12-lead data

A matrix with data for 12-leads can be generated using the function read_muse_xml_ecg:

# Get sample file
file1 <- ecg_example("muse/muse_ecg1.xml")

# Read xml file - return a 2d matrix
ecg1_2d <- read_muse_xml_ecg(file1, numpyformat = F)

dim(ecg1_2d)

head(ecg1_2d)

# Instead, return a 4d array formatted for AI inputs
ecg1_4d <- read_muse_xml_ecg(file1, numpyformat = T)

dim(ecg1_4d)

A directory of ecg files can be read and returned as an array using the read_muse_xml_directory function:

# Sample directory of muse files
muse_dir <- system.file("extdata", path = "muse", package = "easyRecg")

# Check number of files 
length(dir(muse_dir))

# Read xml files
all_muse <- read_muse_xml_directory(muse_dir)

names(all_muse)
dim(all_muse$ecg_array)

Retrieving Meta Data

For more information on how to filter the provided meta data, please see the "Filtering Meta Data" vignette.

meta1 <- read_muse_xml_meta(file1, ids = 1)
meta1

Data Sources

ECG XML files included in this package are simulated and do not represent actual patient evaluations.



rickeycarter/easyRecg documentation built on Dec. 22, 2021, 4:09 p.m.