-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy path99-appendices.Rmd
More file actions
38 lines (29 loc) · 2.86 KB
/
Copy path99-appendices.Rmd
File metadata and controls
38 lines (29 loc) · 2.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# (APPENDIX) Appendix {-} {#appendix-data}
# Data sets {-}
We have strived to use real data sets throughout the book. An introduction to each data set, as well as it's source and how to import it, is given in the following subsections.
## Ames Iowa housing data {-}
@ames-cock-2011 describes a data set containing the sale of individual residential property in Ames, Iowa from 2006 to 2010. The data set contains 2930 observations and a large number of explanatory variables involved in assessing home values. These data offer a contemporary alternative to the often used Boston housing data described in @harrison1978hedonic.
The Ames housing data, which we refer to as simply the `ames` data, are available in the `AmesHousing` package [@pkg-AmesHousing] which is available from CRAN:
```{r, eval=FALSE}
install.packages("AmesHousing")
```
The raw data are also available from Kaggle: https://www.kaggle.com/c/house-prices-advanced-regression-techniques. In the code chunk below, we use the `make_ames()` function from `AmesHousing` to create a processed version of the data. For full details on the difference between the processed and raw versions of the `ames` data, see the help file `?AmesHousing::make_ames`.
```{r}
ames <- AmesHousing::make_ames()
dim(ames)
table(sapply(ames, class))
```
The function `make_ames()` returns a `"tibble"` object, rather than just an R data frame. For more information on *tibbles*, see the corresponding vignette available in the `tibble` package [@R-tibble] `browseVignettes(package = "tibble")`. Running the code chunk above, we see that there are `r nrow(ames)` observations on `r ncol(ames)` variables (46 are factors, 23 are integer valued, and 12 are numeric).
## Employee attrition data {-}
Due to the continuing concerns organizations have with attracting and retaining top talent, the [IBM Watson Analytics Lab](https://www.ibm.com/communities/analytics/watson-analytics-blog) published an employee attrition data set that allows analysts to explore factors that lead to employee attrition and investigate important questions such as ‘show me a breakdown of distance from home by job role and attrition’ or ‘compare average monthly income by education and attrition’.
The employee attrition data, which we refer to as simply the `churn` data, are available in the `rsample` package [@pkg-rsample] which is available from CRAN:
```{r, eval=FALSE}
install.packages("rsample")
```
The raw data are also available from IBM Watson Analytics Lab: https://www.ibm.com/communities/analytics/watson-analytics-blog/hr-employee-attrition/. In the code chunk below, we import the attrition data from `rsample`.
```{r}
churn <- rsample::attrition
dim(churn)
dplyr::glimpse(churn)
```
Running the code chunk above, we see that there are `r nrow(churn)` observations on `r ncol(churn)` variables, which consist of a mixture of integers, factors, and ordered factors data types).