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_2019
library(testthat)
# Test 1: Check that the object is a data.frame and has 14 columns
test_that("mlb_teams_2019 is a data.frame with 14 columns", {
expect_s3_class(mlb_teams_2019, "data.frame")
expect_equal(ncol(mlb_teams_2019), 14)
expect_equal(length(mlb_teams_2019), 14)
})
# Test 2: Check the number of rows
test_that("mlb_teams_2019 has 30 rows", {
expect_equal(nrow(mlb_teams_2019), 30)
})
# Test 3: Validate column names
test_that("mlb_teams_2019 has correct column names", {
expect_named(
mlb_teams_2019,
c("Team", "League", "Wins", "Runs", "Hits", "Doubles", "Triples",
"HomeRuns", "RBI", "StolenBases", "CaughtStealing", "Walks",
"Strikeouts", "BattingAvg")
)
})
# Test 4: Check data types
test_that("mlb_teams_2019 has correct data types", {
expect_s3_class(mlb_teams_2019$Team, "factor")
expect_type(mlb_teams_2019$Team, "integer")
expect_equal(nlevels(mlb_teams_2019$Team), 30)
expect_s3_class(mlb_teams_2019$League, "factor")
expect_type(mlb_teams_2019$League, "integer")
expect_equal(nlevels(mlb_teams_2019$League), 2)
expect_type(mlb_teams_2019$Wins, "integer")
expect_type(mlb_teams_2019$Runs, "integer")
expect_type(mlb_teams_2019$Hits, "integer")
expect_type(mlb_teams_2019$Doubles, "integer")
expect_type(mlb_teams_2019$Triples, "integer")
expect_type(mlb_teams_2019$HomeRuns, "integer")
expect_type(mlb_teams_2019$RBI, "integer")
expect_type(mlb_teams_2019$StolenBases, "integer")
expect_type(mlb_teams_2019$CaughtStealing, "integer")
expect_type(mlb_teams_2019$Walks, "integer")
expect_type(mlb_teams_2019$Strikeouts, "integer")
expect_type(mlb_teams_2019$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.