Learn R Programming

biosignalEMG (version 2.0.0)

as.emg: Coerce to an 'emg' object

Description

Functions to check if an object is an ‘emg’ object, or coerce it if possible.

Usage

as.emg(x, ...) "as.emg"(x, ...) "as.emg"(x, ...) "as.emg"(x, ...) "as.emg"(x, ...) is.emg(x)

Arguments

x
any R object.
...
additional arguments to be passed to methods (such as the samplingrate or the units of the EMG signal).

Value

as.emg returns an ‘emg’ object.is.emg returns TRUE if its argument is an ‘emg’ object (that is, has “emg” amongst its classes) and FALSE otherwise.

Details

as.emg is a generic function with many methods to coerce an object to an ‘emg’ object.

is.emg checks if x is an ‘emg’ object.

See Also

emg

Examples

Run this code
# Creates 1 sec. of a simulated EMG with only baseline noise
x <- rnorm(1000)
# Coerce a vector into an 'emg' object
emgx <- as.emg(x, sampligrate = 1000)
# Plot the data in emgx
plot(emgx, main = "Synthetic EMG noise")

# Load a data.frame with EMG data
data(emg96627009)
# Coerce a data.frame into an 'emg' object
x <- as.emg(emg96627009)
# Plot the data in x
plot(x, main = "EMG of limb muscles of decorticated cat")

Run the code above in your browser using DataLab