powered by
Performs PCA with visualization suitable for agricultural research data. Includes scree plot, biplot, and variable contributions.
pca_analysis(data, scale = TRUE, ncp = 5, plot = TRUE, verbose = TRUE)
PCA results with eigenvalues, loadings, and scores
Data frame with numeric variables
Logical, whether to scale variables (default TRUE)
Number of components to retain (default 5)
Logical, whether to generate plots
Logical. If TRUE (default), prints formatted output to console.
Lalit Kumar Rolaniya, ICAR-IIPR, Bikaner
data <- data.frame( yield = rnorm(30, 1200, 200), wue = rnorm(30, 4.5, 0.5), protein = rnorm(30, 22, 2), biomass = rnorm(30, 3500, 500) ) pca_analysis(data)
Run the code above in your browser using DataLab