cropDiffusionR
is an R package implementing functions to perform
analysis on the relationship between maize agriculture and temperature changes in prehistory.
This is the official R package for cropDiffusionR, which contains all code associated with the analyses described and presented, including figures and tables, in Gillreath-Brown and Kohler 2024:
Gillreath-Brown, A., and T. A. Kohler (2024). How Maize Farmers in the US Southwest Grew and Prospered Under El Niño but Suffered Under La Niña. KIVA 1–25. https://doi.org/10.1080/00231940.2024.2348941
All code for analysis, figures, and tables is in Maize_Analysis.Rmd.
You can install cropDiffusionR
from GitHub with these lines of R code (Windows users are recommended to install a separate program, Rtools, before proceeding with this step):
if (!require("devtools")) install.packages("devtools")
devtools::install_github("Archaeo-Programmer/cropDiffusionR")
The 📁 vignettes directory contains:
- 📄 Maize_Analysis: R Markdown document with all analysis and code to reproduce the figures and tables for the paper (Gillreath-Brown and Kohler 2024). It also has a rendered version, Maize_Analysis.html, which shows figure and table output.
- 📁 figures: Plots, figures, and illustrations in the paper, including supplementary materials.
- 📁 tables: Tables in the paper, including supplementary materials.
To reproduce the analysis, output, figures, and tables, you will need to clone the repository. To clone the repository, you can do the following from your Terminal:
git clone https://github.com/Archaeo-Programmer/cropDiffusionR.git
cd cropDiffusionR
After installing the cropDiffusionR
package (via install_github
as shown above or by using devtools::install()
), then you can render the analysis, visualizations, and tables.
You can compile the cropDiffusionR
analysis within R by entering the following in the console:
rmarkdown::render(here::here('vignettes/Maize_Analysis.Rmd'), output_dir = here::here('vignettes'))
If you do not want to compile the R Markdowns, then you can retrieve a readable HTML file by navigating to Maize_Analysis.html. Then, click "Raw" and save the file as "Maize_Analysis.html" (i.e., save file with .html
extension or as HTML file type). Another option, after installing the cropDiffusionR
package, is to use rstudioapi::viewer
in the R console:
rstudioapi::viewer(here::here('vignettes/cropDiffusionR.html'))
Another option for reproducing the results is to use the package itself and follow along with the vignette, cropDiffusionR. Data and functions are already loaded into the package.
Code: GNU GPLv3
Data: CC-0 attribution requested in reuse
This material is based upon work supported by the National Science Foundation under Grants SMA-1637171 and SMA-1620462, and by the Office of the Chancellor, Washington State University-Pullman.