emgR overview

Install emgR package

# install.packages("devtools") if not installed
 devtools::install_github("https://github.com/ymatts/emgR")
#install.packages("~/Dropbox/matsui/git/emgR.tar.gz",repos = NULL,type = "source")
library(emgR)

Data acquisition

data(emg)
head(emg,3)

Constructing object

tt = emg$Time # Time record
xx = emg[,-1] # EMG record
obj = emgR::emgList(x = xx,t = tt)
obj

Add annotation

(f = system.file("extdata","gaitAnno.txt",package = "emgR"))
head(read.table(f,header = T,sep="\t"),3)

Add annotation

obj = emgR::addAnnotation(obj,annoFile = f)
head(obj$annotation,3)

Extract EMG signals followed by annotation


Filtering sEMG signals

obj = emgR::btw(obj,order = 4,filtFreq = c(5,200))
obj

Normalize sEMG signals

obj = emgR::normalize(obj)
obj

Extract gait cycle

load("data/cycleTime.rda")
head(cycleTime)

Waveform similiarity analysis

obj = emgR::coherence(obj)
obj

Visualize coherence function

file_path = tempfile()
plot(obj,type="coh",files = file_path,cohRange=c(0,100))

Visualize coherence functions

knitr::include_graphics(file_path)

Aggregate coherence function into means within frequency bands

obj = emgR::aggrCoh(obj,cohRange = c(15,20),plot.it = FALSE)
obj

Aggregate coherence function into means within frequency bands

obj = emgR::aggrCoh(obj,cohRange = c(15,20),plot.it = TRUE)

Coherent muscle network construction

obj = emgR::cohNet(obj,mode = "bin",thres = 0.25,plot.it = FALSE)

Coherent muscle network construction

obj = emgR::cohNet(obj,mode = "bin",thres = 0.25,plot.it = TRUE)

Network based muscle module detection

Network based muscle module detection

obj = emgR::moduleFinder(obj,plot.it = TRUE,plot.type = "graph")

Network based muscle module detection

obj = emgR::moduleFinder(obj,plot.it = TRUE,plot.type = "member")

Muscle synergy (2D-array)



ymatts/emgR documentation built on March 7, 2020, 12:52 a.m.