# 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 . # turnip_density library(testthat) # Test 1: Check that the object is a data.frame and has 4 columns test_that("turnip_density is a data.frame with 4 columns", { expect_s3_class(turnip_density, "data.frame") expect_equal(ncol(turnip_density), 4) expect_equal(length(turnip_density), 4) }) # Test 2: Check the number of rows test_that("turnip_density has 60 rows", { expect_equal(nrow(turnip_density), 60) }) # Test 3: Validate column names test_that("turnip_density has correct column names", { expect_named( turnip_density, c("yield", "block", "spacing", "density") ) }) # Test 4: Check data types test_that("turnip_density has correct data types", { expect_type(turnip_density$yield, "double") expect_s3_class(turnip_density$block, "factor") expect_equal(nlevels(turnip_density$block), 3) expect_type(turnip_density$spacing, "integer") expect_type(turnip_density$density, "double") })