read.csv.signals: Reads and checks if the csv file has the correct structure

View source: R/read.csv.signals.R

read.csv.signalsR Documentation

Reads and checks if the csv file has the correct structure

Description

Reads and checks if the csv file has the correct structure

Usage

read.csv.signals(file, col.names = NULL)

Arguments

file

File to be read and check. The first line of the file must contain two numbers: the sampling rate in Hz (freq) and the signal length in seconds (sec). The function checks whether the file actually contains round(freq*sec) samples. The two numbers must by separated by one or more whitespace characters.

col.names

Vector with column names. If not specified, default names will be created.

Value

A list is returned with: 1) data frame where rows = samples for all channels, columns = channels, 2) sampling rate.

Examples

file <- system.file("extdata", "sample1.csv", package = "MatchingPursuit")

# The first line of the file must contain two numbers:
# a) the sampling rate in Hz
# b) the signal length in seconds
out <- read.csv(file, header = FALSE)
head(out)

signal <- read.csv.signals(file, col.names = "signal_1")
head(signal$signal)
signal$sampling.rate


MatchingPursuit documentation built on April 9, 2026, 9:08 a.m.