feature_selection {PhenoSpectra} | R Documentation |
Feature Selection for Spectral Data
Description
This function filters healthy vs diseased samples, selects the most discriminative spectral variables, applies FDR correction, and exports the results.
Usage
feature_selection(
file_path,
output_path = "selected_features.xlsx",
fdr_threshold = 0.01
)
Arguments
file_path |
Path to the cleaned dataset (output of qaqcs function). |
output_path |
Path to save the selected features table. |
fdr_threshold |
Threshold for filtering significant features (default: 0.01). |
Value
A data.table containing selected spectral variables.
Examples
# Create mock spectral data
library(openxlsx)
mock_data <- data.frame(
treatment = sample(0:1, 100, replace = TRUE),
var1 = rnorm(100),
var2 = rnorm(100),
var3 = rnorm(100)
)
temp_file <- tempfile(fileext = ".xlsx")
write.xlsx(mock_data, temp_file)
# Perform feature selection
output_path <- tempfile(fileext = ".xlsx")
selected_features <- feature_selection(temp_file, output_path, fdr_threshold = 0.01)
head(selected_features)
[Package PhenoSpectra version 0.1.0 Index]