Skip to contents

This function reads all CSV files in the specified folder (or the current working directory, if no folder is provided) that match a given pattern. It selects a predefined set of columns from each CSV and merges the files into a single data frame.

Usage

import_indices(folder = NULL, pattern = "_results.csv")

Arguments

folder

A string specifying the folder path where the CSV files are located. If NULL, the function uses the current working directory.

pattern

A string representing the file name pattern to search for (default is "_results.csv"). This should be a regular expression that matches the files to be imported.

Value

A data frame containing the merged data from all CSV files, with the following columns: file_name, sensor_id, datetime, date, hour, index, value_l, value_r, and value_avg.

Examples

if (FALSE) { # \dontrun{
# Example: Import all CSV files matching the pattern "_results.csv" from a folder
folder_path <- "path/to/folder"
combined_data <- import_indices(folder = folder_path, pattern = "_results.csv")

# Example: Import from the current working directory with default pattern
combined_data <- import_indices()
} # }