Skip to content

Commit

Permalink
Merge pull request #20 from rolkra/use-data-starwars
Browse files Browse the repository at this point in the history
Use data starwars
  • Loading branch information
rolkra committed Sep 5, 2023
2 parents 6b65434 + 030e916 commit d6ad826
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 2 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export(use_data_iris)
export(use_data_mpg)
export(use_data_mtcars)
export(use_data_penguins)
export(use_data_starwars)
export(use_data_titanic)
export(weight_target)
import(dplyr)
Expand Down
15 changes: 14 additions & 1 deletion R/use-data.R
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ use_data_mpg <- function() {
#' Use the diamonds data set
#'
#' This data set comes with the ggplot2 package.
#' It containing the prices and other attributes of almost 54,000 diamonds.
#' It contains the prices and other attributes of almost 54,000 diamonds.
#' @return Dataset
#' @examples
#' use_data_diamonds()
Expand All @@ -61,6 +61,19 @@ use_data_diamonds <- function() {
return(ggplot2::diamonds)
}

#' Use the starwars data set
#'
#' This data set comes with the dplyr package.
#' It contains data of 87 star war characters
#' #' @return Dataset
#' @examples
#' use_data_starwars()
#' @export

use_data_starwars <- function() {
return(dplyr::starwars)
}

#' Use the penguins data set
#'
#' This data set comes with the palmerpenguins package.
Expand Down
2 changes: 1 addition & 1 deletion man/use_data_diamonds.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions man/use_data_starwars.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions tests/testthat/test-use-data.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ test_that("use_data returns a data frame.", {
expect_s3_class(use_data_mtcars(), "data.frame")
expect_s3_class(use_data_mpg(), "data.frame")
expect_s3_class(use_data_diamonds(), "data.frame")
expect_s3_class(use_data_starwars(), "data.frame")
expect_s3_class(use_data_penguins(), "data.frame")
expect_s3_class(use_data_titanic(), "data.frame")
})
Expand All @@ -14,6 +15,7 @@ test_that("use_data returns data frames with >0 rows", {
expect_gt(nrow(use_data_mtcars()), 0)
expect_gt(nrow(use_data_mpg()), 0)
expect_gt(nrow(use_data_diamonds()), 0)
expect_gt(nrow(use_data_starwars()), 0)
expect_gt(nrow(use_data_penguins()), 0)
expect_gt(nrow(use_data_titanic()), 0)
})
Expand Down

0 comments on commit d6ad826

Please sign in to comment.