Skip to content

Commit 9e86a2b

Browse files
Add duke forest homes data (#53)
1 parent f00ca5e commit 9e86a2b

File tree

7 files changed

+233
-1
lines changed

7 files changed

+233
-1
lines changed

NEWS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
* Added new datasets:
44
* `lizard_run` and `lizard_habitat` (thanks Stephen Adolph!)
5-
* `daycare_fines`, `biontech_adolescents`, `nyc_marathon`, `epa2021`
5+
* `daycare_fines`, `biontech_adolescents`, `nyc_marathon`, `epa2021`, `duke_forest`
66
* Add tests for some of the new datasets
77
* Better terminology: `sex_discrimination`
88

R/data-duke_forest.R

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#' Houses for sale in Duke Forest, Durham, NC in Nov 2020
2+
#'
3+
#' Data on houses that were for sale in the Duke Forest neighborhood of
4+
#' Durham, NC in November 2020.
5+
#'
6+
#' @format A data frame with 98 rows and 13 variables.
7+
#' \describe{
8+
#' \item{address}{Address of house.}
9+
#' \item{price}{Listing price, in USD.}
10+
#' \item{bed}{Number of bedrooms.}
11+
#' \item{bath}{Number of bathrooms.}
12+
#' \item{area}{Area of home, in square feet.}
13+
#' \item{type}{Type of home (all are Single Family).}
14+
#' \item{year_built}{Year the home was built.}
15+
#' \item{heating}{Heating sytem.}
16+
#' \item{cooling}{Cooling system (`central` or `other`).}
17+
#' \item{parking}{Type of parking available and number of parking spaces.}
18+
#' \item{lot}{Area of the entire property, in acres.}
19+
#' \item{hoa}{If the home belongs to an Home Owners Association, the associted fee (`NA` otherwise).}
20+
#' \item{url}{URL of the listing.}
21+
#' }
22+
#' @examples
23+
#'
24+
#' library(ggplot2)
25+
#'
26+
#' # Number of bedrooms and price
27+
#' ggplot(duke_forest, aes(x = as.factor(bed), y = price)) +
28+
#' geom_boxplot() +
29+
#' labs(
30+
#' x = "Number of bedrooms",
31+
#' y = "Listing price (USD)",
32+
#' title = "Homes for sale in Duke Forest, Durham, NC",
33+
#' subtitle = "Data are from November 2020"
34+
#' )
35+
#'
36+
#' # Area and price
37+
#' ggplot(duke_forest, aes(x = area, y = price)) +
38+
#' geom_point() +
39+
#' labs(
40+
#' x = "Area (square feet)",
41+
#' y = "Listing price (USD)",
42+
#' title = "Homes for sale in Duke Forest, Durham, NC",
43+
#' subtitle = "Data are from November 2020"
44+
#' )
45+
#'
46+
#' @source Data were collected from [Zillow.com](https://www.zillow.com/) in November 2020.
47+
"duke_forest"

data-raw/duke_forest/duke-forest.csv

Lines changed: 99 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# load packages ----------------------------------------------------------------
2+
3+
library(tidyverse)
4+
library(lubridate)
5+
6+
# load data -------------------------------------------------------------------
7+
8+
duke_forest_raw <- read_csv("data-raw/duke_forest/duke-forest.csv")
9+
10+
# clean data -------------------------------------------------------------------
11+
12+
duke_forest <- duke_forest_raw %>%
13+
mutate(
14+
cooling = case_when(
15+
cooling == "Central" ~ "central",
16+
cooling == "Central, Other" ~ "central",
17+
TRUE ~ "other"
18+
)
19+
) %>%
20+
rename(url = link) %>%
21+
relocate(url, .after = last_col())
22+
23+
# Save ------------------------------------------------------------------------
24+
25+
usethis::use_data(duke_forest, overwrite = TRUE)

data/duke_forest.rda

3.71 KB
Binary file not shown.

man/duke_forest.Rd

Lines changed: 60 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkgdown/_pkgdown.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ reference:
8787
- dream
8888
- drone_blades
8989
- drug_use
90+
- duke_forest
9091
- earthquakes
9192
- ebola_survey
9293
- elmhurst

0 commit comments

Comments
 (0)