Skip to content

Commit

Permalink
Merge pull request #33 from ropensci/misc
Browse files Browse the repository at this point in the history
Misc fixes and tweaks
  • Loading branch information
jrdnbradford authored Aug 14, 2024
2 parents 8ff0f14 + 9f33bbf commit dfc5b4d
Show file tree
Hide file tree
Showing 24 changed files with 45 additions and 39 deletions.
10 changes: 5 additions & 5 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ and be available under an open license.
It is much preferred that you contribute the dataset via a pull request.
To add a dataset:

1. Add the raw data and an R script to load and save it as an R data
object to `data-raw/`. The `.rda` file should be saved to `data/`.
See `data-raw/sarna.R` as a model.
2. Add the documentation using [{roxygen2}](https://roxygen2.r-lib.org/)
to a file in `R/`. Use `R/sarna.R` as a model. Be sure to include a citation.
1. Add the raw data to `data-raw` and an R script to load and save it as an R data
object to `data-raw/scripts`. The `.rda` file should be saved to `data/`.
See `data-raw/scripts/sarna.R` as a model.
1. Add the documentation using `devtools::document()`. Be sure to include a citation.
1. Run `R-CMD-check` using `devtools::check()`.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: historydata
Type: Package
Title: Datasets for Historians
Version: 0.2.9001
Version: 0.2.9002
Authors@R: c(person("Lincoln", "Mullen",
role = c("aut", "cre"),
email = "[email protected]",
Expand Down
8 changes: 4 additions & 4 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# historydata 0.2 (in development)

- Fix geocoding Mackenzie-Fort Smith in `catholic-dioceses`
- Fix incorrect date in `catholic-dioceses`
- Fix geocoding for Mackenzie-Fort Smith in `catholic-dioceses` (#2)
- Fix incorrect date in `catholic-dioceses` (#8)
- Add `us_military_strengths` (thanks @CB1789, #21)
- Fix typo in `catholic_dioceses` docs
- Add `minneapolisfed_cpi`
- Add `minneapolisfed_cpi` (#3, #13)
- Add `.gitignore`
- Updated {pkgdown} GitHub site
- Updated `.Rbuildignore`
Expand All @@ -15,7 +15,7 @@
- Added `dijon_prices` and `dijon_prices_wide`
- Added `presbyterians`
- Fixed data formatting of `paulist_missions`
- Added `methodists`
- Added `methodists` (#14)

# historydata 0.1

Expand Down
4 changes: 2 additions & 2 deletions R/minneapolisfed_cpi.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#' Consumer Price Index, 1800-
#' Consumer Price Index, 1800-2024
#'
#' This dataset contains historic consumer price index (CPI) data
#' including estimates before the modern U.S. CPI, retrieved from
#' including estimates before the modern U.S. CPI, retrieved from
#' the Federal Reserve Bank of Minneapolis.
#'
#' @section Variables:
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
# {historydata}

<!-- badges: start -->
[![CRAN_Status_Badge](https://www.r-pkg.org/badges/version/historydata.png)](https://cran.r-project.org/package=historydata)

[![R-CMD-check](https://github.com/ropensci/historydata/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/ropensci/historydata/actions/workflows/R-CMD-check.yaml)
[![CRAN
status](https://www.r-pkg.org/badges/version/historydata)](https://CRAN.R-project.org/package=historydata)
<!-- badges: end -->

## Overview
Expand Down
3 changes: 2 additions & 1 deletion README.qmd
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
format: gfm
default-image-extension: ""
---

<!-- README.md is rendered from README.qmd. Edit README.qmd and render to update README.md -->
Expand All @@ -17,7 +18,7 @@ knitr::opts_chunk$set(

<!-- badges: start -->
[![R-CMD-check](https://github.com/ropensci/historydata/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/ropensci/historydata/actions/workflows/R-CMD-check.yaml)
[![CRAN_Status_Badge](https://www.r-pkg.org/badges/version/historydata)](https://cran.r-project.org/package=historydata)
[![CRAN status](https://www.r-pkg.org/badges/version/historydata)](https://CRAN.R-project.org/package=historydata)
<!-- badges: end -->

## Overview
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ library(dplyr)
library(lubridate)
library(tidyr)

catholic_dioceses <- read.csv("data-raw/catholic.dioceses.geocoded.csv",
stringsAsFactors = FALSE)
data_file <- file.path("data-raw", "catholic.dioceses.geocoded.csv")
catholic_dioceses <- read.csv(data_file, stringsAsFactors = FALSE)
catholic_dioceses <-
catholic_dioceses %>%
select(diocese,
Expand Down
8 changes: 5 additions & 3 deletions data-raw/cesta-cities.R → data-raw/scripts/cesta-cities.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ library(readr)
library(dplyr)
library(tidyr)

if (!file.exists("data-raw/cesta-cities.csv")) {

data_file <- file.path("data-raw", "cesta-cities.csv")
if (!file.exists(data_file)) {
download.file("https://raw.githubusercontent.com/cestastanford/historical-us-city-populations/master/data/1790-2010_MASTER.csv",
destfile = "data-raw/cesta-cities.csv")
destfile = data_file)
}

cities <- read_csv("data-raw/cesta-cities.csv")
cities <- read_csv(data_file)

cities <- cities %>%
gather(year, population, -ID, -ST, -City, -CityST, -STPLFIPS_2010, -Name_2010,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ library(dplyr)
library(tibble)
library(stringr)

dijon_prices_wide <- read_csv("data-raw/dijon-prices-wide.csv")
dijon_citations <- read_csv("data-raw/dijon-citations.csv") %>%
dijon_prices_wide <- read_csv(file.path("data-raw", "dijon-prices-wide.csv"))
dijon_citations <- read_csv(file.path("data-raw", "dijon-citations.csv")) %>%
select(-1) %>%
t() %>%
as.data.frame() %>%
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
library(dplyr)
early_colleges <- read.csv("data-raw/early-colleges.csv", stringsAsFactors = FALSE,
early_colleges <- read.csv(file.path("data-raw", "early-colleges.csv"), stringsAsFactors = FALSE,
na.strings = "")
early_colleges <- early_colleges %>%
as_tibble()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ library(dplyr)
library(tidyr)
library(devtools)

data_file <- file.path("data-raw", "judges.csv")
export_url <- "http://www.fjc.gov/history/export/jb.txt"
download.file(export_url, destfile = "data-raw/judges.csv")
download.file(export_url, destfile = data_file)

judges <- read.csv("data-raw/judges.csv", stringsAsFactors = FALSE) %>%
judges <- read.csv(data_file, stringsAsFactors = FALSE) %>%
as_tibble()

judges_people <- judges %>%
Expand Down
2 changes: 1 addition & 1 deletion data-raw/methodists.R → data-raw/scripts/methodists.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ replace_na <- function(x, val = 0L) {
ifelse(is.na(x), val, x)
}

methodists <- read_csv("data-raw/methodists.csv") %>%
methodists <- read_csv(file.path("data-raw", "methodists.csv")) %>%
filter(minutes_year != 1778,
minutes_year != 1779,
minutes_year != 1785) %>%
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
library(dplyr)
library(tidyr)
naval_promotions <- read.csv("data-raw/naval-promotions.csv",
naval_promotions <- read.csv(file.path("data-raw", "naval-promotions.csv"),
stringsAsFactors = FALSE)
# Assign a unique ID to each person:
naval_promotions$id <- 1:nrow(naval_promotions)
Expand Down
2 changes: 1 addition & 1 deletion data-raw/paulists.R → data-raw/scripts/paulists.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ to_weeks <- function(x) {
x
}

paulist_missions <- read_csv("data-raw/paulist-missions.geocoded.csv") %>%
paulist_missions <- read_csv(file.path("data-raw", "paulist-missions.geocoded.csv")) %>%
mutate(start_date = mdy(start_date),
end_date = mdy(end_date)) %>%
mutate(year = year(start_date)) %>%
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
library(readr)
library(dplyr)
pres <- read_csv("data-raw/weber-1927.csv")
pres <- read_csv(file.path("data-raw", "weber-1927.csv"))

presbyterians <- pres %>%
mutate(denomination = ifelse(denomination == "Reunited Presbyterians",
Expand Down
2 changes: 1 addition & 1 deletion data-raw/quasi-war.R → data-raw/scripts/quasi-war.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
library(readr)
library(lubridate)
library(dplyr)
quasi_war <- read_csv("data-raw/quasi-war.csv")
quasi_war <- read_csv(file.path("data-raw", "quasi-war.csv"))

quasi_war <- quasi_war %>%
mutate(year = year(date),
Expand Down
2 changes: 1 addition & 1 deletion data-raw/sarna.R → data-raw/scripts/sarna.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
library(dplyr)
library(tidyr)
sarna <- read.csv("data-raw/sarna.csv", stringsAsFactors = FALSE)
sarna <- read.csv(file.path("data-raw", "sarna.csv"), stringsAsFactors = FALSE)
sarna <- sarna %>%
as_tibble() %>%
select(year,
Expand Down
5 changes: 5 additions & 0 deletions data-raw/scripts/tudors.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
library(dplyr)

tudors <- read.csv(file.path("data-raw", "tudors.csv"), stringsAsFactors = FALSE) %>%
as_tibble
usethis::use_data(tudors, overwrite = TRUE)
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
library(dplyr)
us_state_populations <- read.csv("data-raw/nhgis0011_ts_state.csv",
us_state_populations <- read.csv(file.path("data-raw", "nhgis0011_ts_state.csv"),
stringsAsFactors = FALSE)
us_national_population <- us_state_populations %>%
select(year = YEAR,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
library(dplyr)
us_state_populations <- read.csv("data-raw/nhgis0011_ts_state.csv",
us_state_populations <- read.csv(file.path("data-raw", "nhgis0011_ts_state.csv"),
stringsAsFactors = FALSE)
us_state_populations <- us_state_populations %>%
select(GISJOIN,
Expand Down
File renamed without changes.
5 changes: 0 additions & 5 deletions data-raw/tudors.R

This file was deleted.

4 changes: 2 additions & 2 deletions man/minneapolisfed_cpi.Rd

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

0 comments on commit dfc5b4d

Please sign in to comment.