Skip to contents

The `validate_agri_data` function serves as the primary data defense matrix of the AgriDataTools package. It is engineered to perform exhaustive, multi-dimensional quality control, type alignment checks, and semantic structural audits on user-provided datasets before they are passed to sensitive breeding and quantitative genetic workflows.

Usage

validate_agri_data(data, strict_mode = TRUE, reporting_level = 2)

Arguments

data

A non-null data.frame containing the experimental field trial records.

strict_mode

A logical scalar. If TRUE, the validation engine demands an absolute structural match with the core dataset archetype: exactly 120 rows, 40 distinct genotypes, 3 replications, and all 7 mandatory phenotypic traits (PH, SL, PL, NOT, NOSS, TGW, GYPM). Defaults to TRUE.

reporting_level

An integer mapping scale indicating console log verbosity: 0 for dead silent, 1 for critical system steps, and 2 for exhaustive vector diagnostics. Defaults to 2.

Value

A logical scalar TRUE if the dataset completely satisfies the operational constraints of the biometrical pipeline. If any structural non-compliance is detected, it throws a highly structured, informative exception detailing the exact coordinates of the failure.

Details

In biometric computing, agricultural research, and plant breeding quantitative data analysis, downstream models like ANOVA, Heritability estimations, and Path analysis are highly vulnerable to layout irregularities. Silent formatting issues inside spreadsheets can bias variance components or trigger generic engine failures.

To solve this, `validate_agri_data` runs an automated, multi-tiered defensive pipeline:

  1. Object and Class Matrix Verification: Ensures the input object is a true dataframe.

  2. Dimension Capability Evaluation: Checks for absolute row/column structural thresholds.

  3. Strict Column Header Matching: Verifies the existence of structural keys and core traits.

  4. Categorical Factor Integrity Audits: Verifies grouping layouts for Genotypes and Replications.

  5. Quantitative Type Compliance Testing: Validates phenotypic trait vectors for numeric compliance.

  6. Biological Range and Bound Inspections: Screens for mathematical anomalies like negative values.

  7. Missing Value (NA) Variance Profiling: Analyzes missing data distribution across blocks.

References

  • Cochran, W.G. and Cox, G.M. (1957). Experimental Designs. 2nd Edition, John Wiley & Sons, New York.

  • Falconer, D.S. and Mackay, T.F.C. (1996). Introduction to Quantitative Genetics. 4th Edition, Longman, Essex.

Examples

# Assuming package environments are active and datasets are loaded via data(gv_data)
if (interactive()) {
    # Trigger standard validation sweep
    validation_status <- validate_agri_data(data = gv_data, strict_mode = TRUE)
    message("Is dataset operational? ", validation_status)
}