# 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 . # carrot_insecticide library(testthat) # Test 1: Check that the object is a data.frame and has 6 columns test_that("carrot_insecticide is a data.frame with 6 columns", { expect_s3_class(carrot_insecticide, "data.frame") expect_equal(ncol(carrot_insecticide), 6) expect_equal(length(carrot_insecticide), 6) }) # Test 2: Check the number of rows test_that("carrot_insecticide has 36 rows", { expect_equal(nrow(carrot_insecticide), 36) }) # Test 3: Validate column names test_that("carrot_insecticide has correct column names", { expect_named( carrot_insecticide, c("treatment", "insecticide", "depth", "rep", "damaged", "total") ) }) # Test 4: Check data types test_that("carrot_insecticide has correct data types", { expect_s3_class(carrot_insecticide$treatment, "factor") expect_equal(nlevels(carrot_insecticide$treatment), 11) expect_s3_class(carrot_insecticide$insecticide, "factor") expect_equal(nlevels(carrot_insecticide$insecticide), 3) expect_type(carrot_insecticide$depth, "double") expect_s3_class(carrot_insecticide$rep, "factor") expect_equal(nlevels(carrot_insecticide$rep), 3) expect_type(carrot_insecticide$damaged, "integer") expect_type(carrot_insecticide$total, "integer") })