diff --git a/R/datasets.R b/R/datasets.R index edbd6faa2..e9a324960 100644 --- a/R/datasets.R +++ b/R/datasets.R @@ -28,17 +28,17 @@ #' hemisphere latitudes. For determination of afternoon values, the presented #' tabulated values are symmetric about noon. #' -#' The solar zenith angle (SZA) is one measure that helps to describe the -#' sun's path across the sky. It's defined as the angle of the sun relative -#' to a line perpendicular to the earth's surface. It is useful to calculate -#' the SZA in relation to the true solar time. True solar time relates to -#' the position of the sun with respect to the observer, which is different -#' depending on the exact longitude. For example, two hours before the sun -#' crosses the meridian (the highest point it would reach that day) -#' corresponds to a true solar time of 10 a.m. The SZA has a strong -#' dependence on the observer's latitude. For example, at a latitude of 50 -#' deg N at the start of January, the noontime SZA is 73.0 but a different -#' observer at 20 deg N would measure the noontime SZA to be 43.0 degrees. +#' The solar zenith angle (SZA) is one measure that helps to describe the sun's +#' path across the sky. It's defined as the angle of the sun relative to a line +#' perpendicular to the earth's surface. It is useful to calculate the SZA in +#' relation to the true solar time. True solar time relates to the position of +#' the sun with respect to the observer, which is different depending on the +#' exact longitude. For example, two hours before the sun crosses the meridian +#' (the highest point it would reach that day) corresponds to a true solar time +#' of 10 a.m. The SZA has a strong dependence on the observer's latitude. For +#' example, at a latitude of 50 deg N at the start of January, the noontime SZA +#' is 73.0 but a different observer at 20 deg N would measure the noontime SZA +#' to be 43.0 degrees. #' #' @format A tibble with 816 rows and 4 variables: #' \describe{ @@ -91,10 +91,9 @@ #' Daily S&P 500 Index data from 1950 to 2015 #' -#' This dataset provides daily price indicators for the S&P 500 index -#' from the beginning of 1950 to the end of 2015. The index includes 500 -#' leading companies and captures about 80% coverage of available market -#' capitalization. +#' This dataset provides daily price indicators for the S&P 500 index from the +#' beginning of 1950 to the end of 2015. The index includes 500 leading +#' companies and captures about 80% coverage of available market capitalization. #' #' @format A tibble with 16607 rows and 7 variables: #' \describe{ @@ -110,17 +109,16 @@ #' A year of pizza sales from a pizza place #' -#' A synthetic dataset that describes pizza sales for a pizza place -#' somewhere in the US. While the contents are artificial, the -#' ingredients used to make the pizzas are far from it. There are 32 -#' different pizzas that fall into 4 different categories: \code{classic} -#' (classic pizzas: 'You probably had one like it before, but never like -#' this!'), \code{chicken} (pizzas with chicken as a major ingredient: 'Try -#' the Southwest Chicken Pizza! You'll love it!'), \code{supreme} (pizzas -#' that try a little harder: 'My Soppressata pizza uses only the finest -#' salami from my personal salumist!'), and, \code{veggie} (pizzas without -#' any meats whatsoever: 'My Five Cheese pizza has so many cheeses, I can -#' only offer it in Large Size!'). +#' A synthetic dataset that describes pizza sales for a pizza place somewhere in +#' the US. While the contents are artificial, the ingredients used to make the +#' pizzas are far from it. There are 32 different pizzas that fall into 4 +#' different categories: \code{classic} (classic pizzas: 'You probably had one +#' like it before, but never like this!'), \code{chicken} (pizzas with chicken +#' as a major ingredient: 'Try the Southwest Chicken Pizza! You'll love it!'), +#' \code{supreme} (pizzas that try a little harder: 'My Soppressata pizza uses +#' only the finest salami from my personal salumist!'), and, \code{veggie} +#' (pizzas without any meats whatsoever: 'My Five Cheese pizza has so many +#' cheeses, I can only offer it in Large Size!'). #' #' @format A tibble with 49574 rows and 7 variables: #' \describe{ @@ -142,3 +140,34 @@ #' (in USD)} #' } "pizzaplace" + +#' A toy example tibble for testing with gt: exibble +#' +#' This tibble contains data of a few different classes, which makes it +#' well-suited for quick experimentation with the functions in this package. It +#' contains only eight rows with numeric, character, and factor columns. The +#' last 4 rows contain \code{NA} values in the majority of the tibbles's columns +#' (1 missing value per column). The \code{date}, \code{time}, and +#' \code{datetime} columns are character-based dates/times in the familiar ISO +#' 8601 format. The \code{row} and \code{group} columns provide for unique +#' rownames and two groups (\code{grp_a} and \code{grp_b}) for experimenting +#' with the \code{\link{gt}()} function's \code{rowname_col} and +#' \code{groupname_col} arguments. +#' +#' @format A tibble with 8 rows and 9 variables: +#' \describe{ +#' \item{num}{a numeric column ordered with increasingly larger values} +#' \item{char}{a character column composed of names of fruits from \code{a} to +#' \code{h}} +#' \item{fctr}{a factor column with numbers from 1 to 8, written out} +#' \item{date, time, datetime}{character columns with dates, times, and +#' datetimes} +#' \item{currency}{a numeric column that is useful for testing currency-based +#' formatting} +#' \item{row}{a character column in the format \code{row_X} which can be +#' useful for testing with row captions in a table stub} +#' \item{group}{a character column with four \code{grp_a} values and four +#' \code{grp_b} values which can be useful for testing tables that contain +#' row groups} +#' } +"exibble" diff --git a/data-raw/06-exibble.R b/data-raw/06-exibble.R new file mode 100644 index 000000000..62fd6f5f9 --- /dev/null +++ b/data-raw/06-exibble.R @@ -0,0 +1,18 @@ +library(tidyverse) + +exibble <- + dplyr::tribble( + ~num, ~char, ~fctr, ~date, ~time, ~datetime, ~currency, ~row, ~group, + 0.1111, "apricot", "one", "2015-01-15", "13:35", "2018-01-01 02:22", 49.95, "row_1", "grp_a", + 2.222, "banana", "two", "2015-02-15", "14:40", "2018-02-02 14:33", 17.95, "row_2", "grp_a", + 33.33, "coconut", "three", "2015-03-15", "15:45", "2018-03-03 03:44", 1.39, "row_3", "grp_a", + 444.4, "durian", "four", "2015-04-15", "16:50", "2018-04-04 15:55", 65100, "row_4", "grp_a", + 5550, NA, "five", "2015-05-15", "17:55", "2018-05-05 04:00", 1325.81, "row_5", "grp_b", + NA, "fig", "six", "2015-06-15", NA, "2018-06-06 16:11", 13.255, "row_6", "grp_b", + 777000, "grapefruit", "seven", NA, "19:10", "2018-07-07 05:22", NA, "row_7", "grp_b", + 8880000, "honeydew", "eight", "2015-08-15", "20:20", NA, 0.44, "row_8", "grp_b", + ) %>% + dplyr::mutate(fctr = factor(fctr, levels = c( + "one", "two", "three", "four", "five", "six", "seven", "eight" + )) + ) diff --git a/data-raw/zz_process_datasets.R b/data-raw/zz_process_datasets.R index e94086f30..d7e539320 100644 --- a/data-raw/zz_process_datasets.R +++ b/data-raw/zz_process_datasets.R @@ -5,9 +5,10 @@ source("data-raw/02-sza.R") source("data-raw/03-gtcars.R") source("data-raw/04-sp500.R") source("data-raw/05-pizzaplace.R") +source("data-raw/06-exibble.R") # Create external datasets usethis::use_data( - countrypops, sza, gtcars, sp500, pizzaplace, + countrypops, sza, gtcars, sp500, pizzaplace, exibble, internal = FALSE, overwrite = TRUE ) diff --git a/data/exibble.rda b/data/exibble.rda new file mode 100644 index 000000000..a4f338003 Binary files /dev/null and b/data/exibble.rda differ diff --git a/man/exibble.Rd b/man/exibble.Rd new file mode 100644 index 000000000..3e346793e --- /dev/null +++ b/man/exibble.Rd @@ -0,0 +1,38 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/datasets.R +\docType{data} +\name{exibble} +\alias{exibble} +\title{A toy example tibble for testing with gt: exibble} +\format{A tibble with 8 rows and 9 variables: +\describe{ + \item{num}{a numeric column ordered with increasingly larger values} + \item{char}{a character column composed of names of fruits from \code{a} to + \code{h}} + \item{fctr}{a factor column with numbers from 1 to 8, written out} + \item{date, time, datetime}{character columns with dates, times, and + datetimes} + \item{currency}{a numeric column that is useful for testing currency-based + formatting} + \item{row}{a character column in the format \code{row_X} which can be + useful for testing with row captions in a table stub} + \item{group}{a character column with four \code{grp_a} values and four + \code{grp_b} values which can be useful for testing tables that contain + row groups} +}} +\usage{ +exibble +} +\description{ +This tibble contains data of a few different classes, which makes it +well-suited for quick experimentation with the functions in this package. It +contains only eight rows with numeric, character, and factor columns. The +last 4 rows contain \code{NA} values in the majority of the tibbles's columns +(1 missing value per column). The \code{date}, \code{time}, and +\code{datetime} columns are character-based dates/times in the familiar ISO +8601 format. The \code{row} and \code{group} columns provide for unique +rownames and two groups (\code{grp_a} and \code{grp_b}) for experimenting +with the \code{\link{gt}()} function's \code{rowname_col} and +\code{groupname_col} arguments. +} +\keyword{datasets} diff --git a/man/pizzaplace.Rd b/man/pizzaplace.Rd index 696e9f50b..f087f93c8 100644 --- a/man/pizzaplace.Rd +++ b/man/pizzaplace.Rd @@ -27,16 +27,15 @@ pizzaplace } \description{ -A synthetic dataset that describes pizza sales for a pizza place -somewhere in the US. While the contents are artificial, the -ingredients used to make the pizzas are far from it. There are 32 -different pizzas that fall into 4 different categories: \code{classic} -(classic pizzas: 'You probably had one like it before, but never like -this!'), \code{chicken} (pizzas with chicken as a major ingredient: 'Try -the Southwest Chicken Pizza! You'll love it!'), \code{supreme} (pizzas -that try a little harder: 'My Soppressata pizza uses only the finest -salami from my personal salumist!'), and, \code{veggie} (pizzas without -any meats whatsoever: 'My Five Cheese pizza has so many cheeses, I can -only offer it in Large Size!'). +A synthetic dataset that describes pizza sales for a pizza place somewhere in +the US. While the contents are artificial, the ingredients used to make the +pizzas are far from it. There are 32 different pizzas that fall into 4 +different categories: \code{classic} (classic pizzas: 'You probably had one +like it before, but never like this!'), \code{chicken} (pizzas with chicken +as a major ingredient: 'Try the Southwest Chicken Pizza! You'll love it!'), +\code{supreme} (pizzas that try a little harder: 'My Soppressata pizza uses +only the finest salami from my personal salumist!'), and, \code{veggie} +(pizzas without any meats whatsoever: 'My Five Cheese pizza has so many +cheeses, I can only offer it in Large Size!'). } \keyword{datasets} diff --git a/man/sp500.Rd b/man/sp500.Rd index e653260d0..1f51c5bc5 100644 --- a/man/sp500.Rd +++ b/man/sp500.Rd @@ -19,9 +19,8 @@ Data collected from \url{https://finance.yahoo.com/quote/\%5EGSPC/history/}. sp500 } \description{ -This dataset provides daily price indicators for the S&P 500 index -from the beginning of 1950 to the end of 2015. The index includes 500 -leading companies and captures about 80% coverage of available market -capitalization. +This dataset provides daily price indicators for the S&P 500 index from the +beginning of 1950 to the end of 2015. The index includes 500 leading +companies and captures about 80% coverage of available market capitalization. } \keyword{datasets} diff --git a/man/sza.Rd b/man/sza.Rd index 0b1bd26b6..3a46d7418 100644 --- a/man/sza.Rd +++ b/man/sza.Rd @@ -30,16 +30,16 @@ hemisphere latitudes. For determination of afternoon values, the presented tabulated values are symmetric about noon. } \details{ -The solar zenith angle (SZA) is one measure that helps to describe the -sun's path across the sky. It's defined as the angle of the sun relative -to a line perpendicular to the earth's surface. It is useful to calculate -the SZA in relation to the true solar time. True solar time relates to -the position of the sun with respect to the observer, which is different -depending on the exact longitude. For example, two hours before the sun -crosses the meridian (the highest point it would reach that day) -corresponds to a true solar time of 10 a.m. The SZA has a strong -dependence on the observer's latitude. For example, at a latitude of 50 -deg N at the start of January, the noontime SZA is 73.0 but a different -observer at 20 deg N would measure the noontime SZA to be 43.0 degrees. +The solar zenith angle (SZA) is one measure that helps to describe the sun's +path across the sky. It's defined as the angle of the sun relative to a line +perpendicular to the earth's surface. It is useful to calculate the SZA in +relation to the true solar time. True solar time relates to the position of +the sun with respect to the observer, which is different depending on the +exact longitude. For example, two hours before the sun crosses the meridian +(the highest point it would reach that day) corresponds to a true solar time +of 10 a.m. The SZA has a strong dependence on the observer's latitude. For +example, at a latitude of 50 deg N at the start of January, the noontime SZA +is 73.0 but a different observer at 20 deg N would measure the noontime SZA +to be 43.0 degrees. } \keyword{datasets}