# agridatasets - A Comprehensive Collection of Agricultural and Agronomic Datasets # Version 0.1.1 # 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 . # cotton_pesticide library(testthat) # Test 1: Check that the object is a tibble/data.frame and has 4 columns test_that("cotton_pesticide is a tibble data.frame with 4 columns", { expect_s3_class(cotton_pesticide, "tbl_df") expect_s3_class(cotton_pesticide, "tbl") expect_s3_class(cotton_pesticide, "data.frame") expect_equal(ncol(cotton_pesticide), 4) expect_equal(length(cotton_pesticide), 4) }) # Test 2: Check the number of rows test_that("cotton_pesticide has 25 rows", { expect_equal(nrow(cotton_pesticide), 25) }) # Test 3: Validate column names test_that("cotton_pesticide has correct column names", { expect_named( cotton_pesticide, c("ID", "H", "I", "Weight") ) }) # Test 4: Check data types test_that("cotton_pesticide has correct data types", { expect_s3_class(cotton_pesticide$ID, "factor") expect_equal(nlevels(cotton_pesticide$ID), 25) expect_type(cotton_pesticide$H, "double") expect_type(cotton_pesticide$I, "integer") expect_type(cotton_pesticide$Weight, "double") })