Nothing
# sportsR - A Comprehensive Collection of Sports and Athletics 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 <https://www.gnu.org/licenses/>.
# mlb_teams_2024
library(testthat)
# Test 1: Check that the object is a data.frame and has 14 columns
test_that("mlb_teams_2024 is a data.frame with 14 columns", {
expect_s3_class(mlb_teams_2024, "data.frame")
expect_equal(ncol(mlb_teams_2024), 14)
expect_equal(length(mlb_teams_2024), 14)
})
# Test 2: Check the number of rows
test_that("mlb_teams_2024 has 30 rows", {
expect_equal(nrow(mlb_teams_2024), 30)
})
# Test 3: Validate column names
test_that("mlb_teams_2024 has correct column names", {
expect_named(
mlb_teams_2024,
c("Team", "League", "Wins", "Runs", "Hits", "Doubles", "Triples",
"HomeRuns", "RBI", "StolenBases", "CaughtStealing", "Walks",
"Strikeouts", "BattingAvg")
)
})
# Test 4: Check data types
test_that("mlb_teams_2024 has correct data types", {
expect_type(mlb_teams_2024$Team, "character")
expect_type(mlb_teams_2024$League, "character")
expect_type(mlb_teams_2024$Wins, "integer")
expect_type(mlb_teams_2024$Runs, "integer")
expect_type(mlb_teams_2024$Hits, "integer")
expect_type(mlb_teams_2024$Doubles, "integer")
expect_type(mlb_teams_2024$Triples, "integer")
expect_type(mlb_teams_2024$HomeRuns, "integer")
expect_type(mlb_teams_2024$RBI, "integer")
expect_type(mlb_teams_2024$StolenBases, "integer")
expect_type(mlb_teams_2024$CaughtStealing, "integer")
expect_type(mlb_teams_2024$Walks, "integer")
expect_type(mlb_teams_2024$Strikeouts, "integer")
expect_type(mlb_teams_2024$BattingAvg, "double")
})
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.