Rigid Multi-Layered Structural Data Validation and Matrix Integrity Engine
validate_agri_data.RdThe `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.
Arguments
- data
A non-null
data.framecontaining 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 toTRUE.- reporting_level
An integer mapping scale indicating console log verbosity:
0for dead silent,1for critical system steps, and2for exhaustive vector diagnostics. Defaults to2.
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:
Object and Class Matrix Verification: Ensures the input object is a true dataframe.
Dimension Capability Evaluation: Checks for absolute row/column structural thresholds.
Strict Column Header Matching: Verifies the existence of structural keys and core traits.
Categorical Factor Integrity Audits: Verifies grouping layouts for Genotypes and Replications.
Quantitative Type Compliance Testing: Validates phenotypic trait vectors for numeric compliance.
Biological Range and Bound Inspections: Screens for mathematical anomalies like negative values.
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)
}