Skip to content

Commit

Permalink
Merge branch 'release/0.11.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
adamblake committed Aug 5, 2023
2 parents 5c00fa4 + 20a50bb commit d08b120
Show file tree
Hide file tree
Showing 12 changed files with 690 additions and 3 deletions.
5 changes: 3 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: coursekata
Title: Packages and Functions for CourseKata Courses
Version: 0.10.0
Date: 2023-08-02
Version: 0.11.0
Date: 2023-08-05
Authors@R: c(
person("Adam", "Blake", , "[email protected]", role = c("cre", "aut"),
comment = c(ORCID = "0000-0001-7881-8652")),
Expand Down Expand Up @@ -33,6 +33,7 @@ Imports:
Metrics,
mosaic (>= 1.8.3),
pak,
palmerpenguins,
purrr (>= 0.3.4),
rlang (>= 1.0.2),
rstudioapi (>= 0.13),
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,6 @@ importFrom(lifecycle,deprecated)
importFrom(lsr,cohensD)
importFrom(magrittr,"%>%")
importFrom(mosaic,qdist)
importFrom(palmerpenguins,path_to_file)
importFrom(stats,lm)
importFrom(supernova,supernova)
1 change: 1 addition & 0 deletions R/coursekata-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ NULL
#' @importFrom mosaic qdist
#' @importFrom supernova supernova
#' @importFrom Metrics sse
#' @importFrom palmerpenguins path_to_file
NULL
45 changes: 44 additions & 1 deletion R/data.R
Original file line number Diff line number Diff line change
Expand Up @@ -382,4 +382,47 @@
#' \item{`game`}{The game the student was randomly assigned to, coded as "A", "B", or "C".}
#' \item{`outcome`}{Each student's score on the outcome test.}
#' }
"game_data"
"game_data"

#' A modified form of the [`palmerpenguins::penguins`][palmerpenguins] data set.
#'
#' The modifications are to select only a subset of the variables, and convert some of the units.
#'
#' @format A data frame with 333 observations on the following 7 variables:
#' \describe{
#' \item{`species`}{The species of penguin, coded as "Adelie", "Chinstrap", or "Gentoo".}
#' \item{`gentoo`}{Whether the penguin is a Gentoo penguin (1) or not (0).}
#' \item{`body_mass_kg`}{The mass of the penguin's body, in kilograms.}
#' \item{`flipper_length_m`}{The length of the penguin's flipper, in m.}
#' \item{`bill_length_cm`}{The length of the penguin's bill, in cm.}
#' \item{`female`}{Whether the penguin is female (1) or not (0).}
#' \item{`island`}{The island where the penguin was observed, coded as "Biscoe", "Dream", or "Torgersen".}
#' }
"penguins"

#' Data on countries from the Happy Planet Index project.
#'
#' These data have been updated with some historical height data (from [Our World in
#' Data](https://ourworldindata.org/human-height)), drinking data (collected by the World Health
#' Organization featured in
#' [fivethirtyeight](https://fivethirtyeight.com/features/dear-mona-followup-where-do-people-drink-the-most-beer-wine-and-spirits/)),
#' population and land characteristics, and vaccination data (from March 2023).
#'
#' @format A data frame with 130 observations on the following 14 variables:
#' \describe{
#' \item{`Country`}{Name of country}
#' \item{`Region`}{One of 5 UN defined regions: Africa, Americas, Asia, Europe, Oceania}
#' \item{`Code`}{Three-letter country codes defined by the International Organization for Standardization ([ISO](https://www.iso.org/iso-3166-country-codes.html)) to represent countries in a way that avoids errors since a country’s name changes depending on the language being used.}
#' \item{`LifeExpectancy`}{Average life expectancy (in years)}
#' \item{`GirlsH1900`}{The average of 18-year-old girls heights in 1900 (in cm)}
#' \item{`GirlsH1980`}{The average of 18-year-old girls heights in 1980 (in cm)}
#' \item{`Happiness`}{Score on a 0-10 scale for average level of happiness (10 being happiest)}
#' \item{`GDPperCapita`}{Gross Domestic Product (per capita)}
#' \item{`FertRate`}{The average number of children that will be born to a woman over her lifetime}
#' \item{`PeopleVacc`}{Total number of people vaccinated in the country}
#' \item{`PeopleVacc_per100`}{Total number of people vaccinated in the country (in percent)}
#' \item{`Population2010`}{Population (in millions) in 2010}
#' \item{`Population2020`}{Population (in millions) in 2020}
#' \item{`WineServ`}{Average wine consumption per capita for those age 15 and over per week (collected by WHO)}
#' }
"World"
20 changes: 20 additions & 0 deletions data-raw/World.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
library(readr)
library(dplyr)
library(usethis)

# Data sent by Ji
World_raw <-
read_csv(
"https://docs.google.com/spreadsheets/d/e/2PACX-1vQhIVfGa0h3qqdi-RlEBtpLhREoURgo0tK_efokXYEJJHe9KjLl-R2oXYKTbjXrWd2exwv1NWHPD2Uk/pub?gid=1108300079&single=true&output=csv",
show_col_types = FALSE,
) |>
write_csv("data-raw/World_raw.csv")

World <- World_raw |>
select(
Country, Region, Code, LifeExpectancy, GirlsH1900, GirlsH1980, Happiness, GDPperCapita,
FertRate, PeopleVacc, PeopleVacc_per100, Population2010, Population2020, WineServ
) |>
na.omit()

use_data(World, overwrite = TRUE, compress = "xz")
201 changes: 201 additions & 0 deletions data-raw/World_raw.csv

Large diffs are not rendered by default.

26 changes: 26 additions & 0 deletions data-raw/penguins.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
library(readr)
library(dplyr)
library(usethis)

# Data sent by Ji
penguins_raw <-
read_csv(
"https://docs.google.com/spreadsheets/d/e/2PACX-1vRG5jslWc4CXMRu60zBEBJ2ZNrC7iiBlM-uKUUFzBPQvLUGaCfX9JCUMPCgsffdozxe6qkh6S8S1b_v/pub?gid=2056245125&single=true&output=csv",
show_col_types = FALSE,
col_select = 2:8
) |>
write_csv("data-raw/penguins_raw.csv")

# Modifications sent by Ji
penguins <- penguins_raw |>
mutate(
gentoo = factor(gentoo),
species = factor(species),
island = factor(island),
female = factor(female),
flipper_length_m = flipper_length_cm / 100,
body_mass_kg = body_mass_g / 1000
) |>
select(1, 2, 9, 8, 4, 7, 3)

use_data(penguins, overwrite = TRUE, compress = "xz")
Loading

0 comments on commit d08b120

Please sign in to comment.