This function performs batch effect correction using the ComBat method from the sva
package. It applies ComBat to the data after imputing missing values, but preserves the missing data (NA values) in the output.
combat_with_na(df, batch)
A numeric matrix or data frame with batch effects corrected, while preserving the original NA values from df
.
# Assuming 'df' is your data frame with missing values and 'batch' is a vector of batch assignments
# adjusted_data <- combat_with_na(df, batch)