--- title: "agridatasets: A Comprehensive Collection of Agricultural and Agronomic Datasets" output: rmarkdown::html_vignette vignette: > %\VignetteIndexEntry{agridatasets: A Comprehensive Collection of Agricultural and Agronomic Datasets} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- ```{r, include = FALSE} knitr::opts_chunk$set( collapse = TRUE, comment = "#>" ) ``` ```{r setup} library(agridatasets) library(dplyr) library(ggplot2) ``` # Introduction The `agridatasets` package offers a rich and diverse collection of datasets focused on agriculture, animal production, plant pathology, soil science, and applied agronomic experimentation. It includes comprehensive data on topics such as **crop yield and growth, plant breeding trials, soil properties and land suitability, pest and disease infestation, herbicide and pesticide efficacy, animal reproduction and weight gain, seed germination, and classical experimental designs used in agricultural research**. The package contains a wide variety of data types, including field trial data, greenhouse and laboratory experiments, longitudinal growth measurements, animal husbandry records, soil composition and classification data, and production/market datasets. These datasets encompass **crop performance under different treatments and cultivars (rice, wheat, corn, soybean, coffee, cotton, eucalyptus, willow, apple, grape, strawberry, tomato, carrot, and other species), livestock and poultry data (cattle, pigs, sheep, ducks, guinea pigs, and broilers), soil munsell color and mineral properties, pesticide and fungicide dose-response trials, classical split-plot and Latin square experimental designs, and coffee production and land suitability assessments across arabica and robusta varieties**. ## All datasets within agridatasets ```{r agridatasets-datasets,echo = TRUE,message = FALSE,warning = FALSE,results = 'markup'} view_datasets_agridatasets() ``` ## Example Datasets Below are selected example datasets included in the `agridatasets` package: - `bamboo_growth`: Bamboo shoot growth measurements across compartments and transects. - `rice_wheat_production`: Historical rice and wheat area, production, and yield statistics. - `cattle_butterfat`: Butterfat content in cattle by breed and age. ## Data Visualization with agridatasets Data ### Old vs New Bamboo Shoots by Compartment ```{r bamboo-growth-plot, fig.width=6, fig.height=4, out.width="100%"} # Summarize average shoot counts by Compartment using base R + dplyr summary_data <- bamboo_growth %>% dplyr::group_by(Compartment) %>% dplyr::summarise( Old_Shoots = mean(Old_Shoots, na.rm = TRUE), New_Shoots = mean(New_Shoots, na.rm = TRUE) ) %>% as.data.frame() %>% reshape( varying = c("Old_Shoots", "New_Shoots"), v.names = "Value", timevar = "Shoot_Type", times = c("Old_Shoots", "New_Shoots"), direction = "long" ) %>% dplyr::select(Compartment, Shoot_Type, Value) # Create a grouped bar chart ggplot(summary_data, aes(x = factor(Compartment), y = Value, fill = Shoot_Type)) + geom_col(position = "dodge", color = "white") + scale_fill_manual(values = c("Old_Shoots" = "lightblue", "New_Shoots" = "darkred")) + labs( title = "Average Old vs New Bamboo Shoots by Compartment", x = "Compartment", y = "Average Number of Shoots", fill = "Shoot Type" ) + theme_minimal() + theme(axis.text.x = element_text(angle = 45, hjust = 1)) ``` ### Rice vs Wheat Yield Over Time ```{r rice-wheat-yield-plot, fig.width=7, fig.height=4, out.width="100%"} # Extract the starting year as numeric for correct chronological ordering plot_data <- rice_wheat_production %>% dplyr::mutate( Year_num = as.numeric(substr(as.character(Year), 1, 4)) ) %>% dplyr::arrange(Year_num) # Create a line plot comparing Yield trends for Rice and Wheat ggplot2::ggplot(plot_data, ggplot2::aes(x = Year_num, y = Yield, color = Food)) + ggplot2::geom_line(linewidth = 1) + ggplot2::geom_point(size = 1.5, alpha = 0.7) + ggplot2::scale_color_manual(values = c("Rice" = "darkgreen", "Wheat" = "goldenrod")) + ggplot2::labs( title = "Rice vs Wheat Yield Over Time", x = "Year", y = "Yield (kg/hectare)", color = "Crop" ) + ggplot2::theme_minimal() + ggplot2::theme(axis.text.x = ggplot2::element_text(angle = 45, hjust = 1)) ``` ### Butterfat Content by Breed and Age ```{r cattle-butterfat-plot, fig.width=7, fig.height=4, out.width="100%"} # Create a boxplot comparing Butterfat content across Breed, split by Age ggplot2::ggplot(cattle_butterfat, ggplot2::aes(x = Breed, y = Butterfat, fill = Age)) + ggplot2::geom_boxplot(outlier.color = "black", outlier.size = 1.5) + ggplot2::scale_fill_manual(values = c("2year" = "lightblue", "Mature" = "darkred")) + ggplot2::labs( title = "Butterfat Content by Cattle Breed and Age", x = "Breed", y = "Butterfat (%)", fill = "Age" ) + ggplot2::theme_minimal() + ggplot2::theme(axis.text.x = ggplot2::element_text(angle = 45, hjust = 1)) ``` ## Conclusion The `agridatasets` package offers a comprehensive and curated collection of datasets spanning a wide spectrum of agricultural, agronomic, and animal science domains. By integrating data from classical field trial designs, plant breeding programs, soil science surveys, livestock and poultry records, pest and disease studies, and international production statistics, this package provides researchers with robust resources for applied agricultural research. Whether you are conducting exploratory data analysis, building predictive and yield models, testing statistical hypotheses, teaching experimental design, or exploring crop and livestock performance across regions and treatments, `agridatasets` delivers well-structured, documented, and diverse datasets that reflect the complexity of modern and historical agricultural systems.