Skip to content

Commit

Permalink
Update vignette and add index.md
Browse files Browse the repository at this point in the history
  • Loading branch information
elinw committed Oct 29, 2020
1 parent 9f7f344 commit 8bcee3c
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 8 deletions.
26 changes: 26 additions & 0 deletions index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@

<!-- README.md is generated from README.Rmd. Please edit that file -->
# Salem <img src="man/figures/logo.png" align="right" height="250" />

<!-- badges: start -->
<!-- badges: end -->
The goal of salem is to provide access to data and other materials related to the Salem Witchcraft Trials which took place in Salem, Massachusetts and the surrounding region in 1692. It is based on the work of historian Richard Latner which is available at [The Salem Witchcraft Site](https://www.tulane.edu/~salem/).

One of the important goals of this project is to make this data available for educational purposes, whether in history, statistics, sociology or other areas. The "Recreating the Website Analyses" describes and provides basic examples of how to reproduce the analyses on the original site. This is merely a jumping off point for many possible analyses that these data sets can be used for. In future work we will be adding advice to instructors who would like to work with this data in courses.

## Installation

We're not on CRAN yet, but you can install the development version from github.

``` r
# install.packages("devtools")
devtools::install_github("elinw/salem")
```

The raw data from the website and the code used to convert it to R data frames is available in the rawdata folder of this respository.

<a title="W.P. Upham, Public domain, via Wikimedia Commons" href="https://commons.wikimedia.org/wiki/File:Salem_Village_-_map_of_-_Project_Gutenberg_eText_17845.jpg"><img width="512" alt="Salem Village - map of - Project Gutenberg eText 17845" src="https://upload.wikimedia.org/wikipedia/commons/thumb/a/ae/Salem_Village_-_map_of_-_Project_Gutenberg_eText_17845.jpg/512px-Salem_Village_-_map_of_-_Project_Gutenberg_eText_17845.jpg"></a>

## Contributing

Although this is a fairly well-defined package with a specific purpose, contributions are welcome. Please submit issues and pull requests at our github repository. Additional relevant, appropriately licensed data sets will be considered for inclusion directly or through APIs on a case by case basis. Potential supplemental materials such as Shiny Apps, tutorials or vignettes may also be considered.
17 changes: 9 additions & 8 deletions vignettes/recreating_analyses.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,12 @@ As is always true in R, there are many different ways to do the same thing.
If you are using this for teaching purposes you will likely want to use
the approach that most closely matches what you are doing in your course and
what your goals are for students to work on their own analyses. The focus
of this document is on use of _ggplot2_ for graphing and in a subsequent iteration
of this document is on use of _ggplot2_ for graphing and in subsequent iterations
will also illustrate use of the base R plotting system. There are some
examples that use the tidyverse for analysis and some that use base R.
However, even within these major groupings there are many ways to acheive
the same goals.
the same goals. We have aimed to present ways to do this that
are relatively accessible to people who have not used R extensively.

Many of the analyses presented are graphical and so that will be the focus
here. However some preprocessing will also be illustrated.
Expand All @@ -58,7 +59,7 @@ salem_theme <- theme(axis.text.x = element_text(angle = 45, vjust = .5))

## Ggplot and the Tidyverse

### Accusations.
### Accusations

The website includes displays of the distribution by month.

Expand Down Expand Up @@ -342,23 +343,23 @@ newdata <- salem_region %>% mutate(February.Any = February > 0, March.Any = Marc
newdata$TOWN_LABEL <- ifelse(newdata$n_accused == 0, NA, newdata$TOWN_LABEL)
```

```{r fig.width=8}
```{r fig.width=8, fig.height=8}
p1 <- ggplot(newdata)
p2 <- geom_sf_text(aes(label = TOWN_LABEL), color = "blue", size = 2, nudge_x = 5,
nudge_y = 5, na.rm = TRUE)
p3 <- scale_fill_manual(values = c( "grey", "red"), na.value = "white")
p1 + geom_sf(data = newdata, aes(fill = February.Any), color = "black") +
p1 + geom_sf(data = newdata, aes(fill = February.Any), color = "black", size = .1) +
p3 + p2 + labs(title = "Location of Accusations in February")
p1 + geom_sf(data = newdata, aes(fill = July.Any), color = "black") +
p1 + geom_sf(data = newdata, aes(fill = July.Any), color = "black", size = .1) +
p3 + p2 + labs(title = "Location of Accusations in July")
p1 + geom_sf(data = newdata, aes(fill = August.Any), color = "black") +
p1 + geom_sf(data = newdata, aes(fill = August.Any), color = "black", size = .1) +
p3 + p2 + labs(title = "Location of Accusations in August")
p1 + geom_sf(data = newdata, aes(fill = November.Any), color = "black") +
p1 + geom_sf(data = newdata, aes(fill = November.Any), color = "black", size = .1) +
p3 + p2 + labs(title = "Location of Accusations in November")
```
Expand Down

0 comments on commit 8bcee3c

Please sign in to comment.