library(openxlsx)
# Create mock raw data
raw_data <- data.frame(
treatment = sample(0:1, 100, replace = TRUE),
var1 = rnorm(100),
var2 = rnorm(100),
var3 = rnorm(100)
)
# Save mock data to a temporary file
raw_data_file <- tempfile(fileext = ".xlsx")
output_file <- tempfile(fileext = ".xlsx")
write.xlsx(raw_data, raw_data_file)
# Run QA/QC with missing values imputed and outliers removed
cleaned_result <- qaqcs(
file_path = raw_data_file,
output_path = output_file,
handle_missing = "impute",
handle_outliers = "remove",
group_by_col = "treatment"
)
head(cleaned_result$cleaned_data)
Run the code above in your browser using DataLab