# agridatasets - A Comprehensive Collection of Agricultural and Agronomic Datasets # Version 0.1.0 # Copyright (C) 2026 Renzo Caceres Rossi # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # blackgrass_herbicide library(testthat) # Test 1: Check that the object is a tibble/data.frame and has 7 columns test_that("blackgrass_herbicide is a tibble data.frame with 7 columns", { expect_s3_class(blackgrass_herbicide, "tbl_df") expect_s3_class(blackgrass_herbicide, "tbl") expect_s3_class(blackgrass_herbicide, "data.frame") expect_equal(ncol(blackgrass_herbicide), 7) expect_equal(length(blackgrass_herbicide), 7) }) # Test 2: Check the number of rows test_that("blackgrass_herbicide has 135 rows", { expect_equal(nrow(blackgrass_herbicide), 135) }) # Test 3: Validate column names test_that("blackgrass_herbicide has correct column names", { expect_named( blackgrass_herbicide, c("ID", "Rep", "DPot", "Population", "Type", "Herbicide", "Fwt") ) }) # Test 4: Check data types test_that("blackgrass_herbicide has correct data types", { expect_s3_class(blackgrass_herbicide$ID, "factor") expect_equal(nlevels(blackgrass_herbicide$ID), 135) expect_s3_class(blackgrass_herbicide$Rep, "factor") expect_equal(nlevels(blackgrass_herbicide$Rep), 5) expect_s3_class(blackgrass_herbicide$DPot, "factor") expect_equal(nlevels(blackgrass_herbicide$DPot), 27) expect_s3_class(blackgrass_herbicide$Population, "factor") expect_equal(nlevels(blackgrass_herbicide$Population), 9) expect_s3_class(blackgrass_herbicide$Type, "factor") expect_equal(nlevels(blackgrass_herbicide$Type), 2) expect_s3_class(blackgrass_herbicide$Herbicide, "factor") expect_equal(nlevels(blackgrass_herbicide$Herbicide), 3) expect_type(blackgrass_herbicide$Fwt, "double") })