From 76a9b1dab2c1359264290cdb57f20f1880b962a4 Mon Sep 17 00:00:00 2001 From: Jeremy Kidwell Date: Sat, 26 Jan 2019 11:09:06 +0000 Subject: [PATCH] updates to yaml and added notes for plots --- README.md | 2 +- mapping_draft.Rmd | 24 +++++++++++++++++++++--- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 580de15..8f14fe3 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ If you're new to github and reproducible research, welcome! It's nice to have you here. Github is ordinarily a place where software developers working on open source software projects deposit their code as they write software collaboratively. However, in recent years a number of scholarly researchers, especially people working on research which involves a digital component (including me!) have begun to deposit their papers in these same software repositories. The idea here is that you can download all of the source-code and data used in this paper alongside the actual text, run it yourself and ["reproduce" the results](http://kbroman.org/steps2rr/). This can serve as a useful safeguard, a layer of research transparency, and a cool teaching tool for other persons interested in doing similar work. -Eschewing proprietary, expensive and unreliable software like Microsoft Word, I write in a combination of two languages: (1) [Markdown](https://en.wikipedia.org/wiki/Markdown) which is intended to be as close as possible to plain text while still allowing for things like boldfaced type, headings and footnotes; and (2) a programming language called [R](https://en.wikipedia.org/wiki/R_(programming_language)) to do all the data analysis. R is an object oriented language which was specifically designed for statistical analysis. It's also great fun to tinker with. As you look through this paper, you'll see that R code is integrated into the text of the document. This is indicated by a series of three backticks (```). +Eschewing proprietary, expensive and unreliable software like Microsoft Word, I write in a combination of two languages: (1) [Markdown](https://en.wikipedia.org/wiki/Markdown) which is intended to be as close as possible to plain text while still allowing for things like boldfaced type, headings and footnotes; and (2) a programming language called [R](https://en.wikipedia.org/wiki/R_(programming_language)) to do all the data analysis. R is an object oriented language which was specifically designed for statistical analysis. It's also great fun to tinker with. As you look through this paper, you'll see that R code is integrated into the text of the document. This is indicated by a series of three backticks (```). There is a formal specification now at a mature stage of development, which is RMarkdown. You can read semi-official specification [for this here](https://bookdown.org/yihui/rmarkdown/pdf-document.html). To read a bit more on these things and start on your own path towards plain text reproducible research, I highly recommend: - Karl Broman's guide, "[Initial Steps Toward Reproducible Research](http://kbroman.org/steps2rr/)" diff --git a/mapping_draft.Rmd b/mapping_draft.Rmd index 05df5fb..9b3fbf3 100644 --- a/mapping_draft.Rmd +++ b/mapping_draft.Rmd @@ -11,8 +11,18 @@ bibliography: /Users/jeremy/Dropbox/bibtex/everything.bib linkcolor: black fontsize: 12pt output: - pdf_document: - keep_tex: true + html_document: + keep_md: true + toc: true + toc_depth: 2 + number_sections: true + fig_caption: true + pdf_document: + keep_tex: true + number_sections: true + fig_caption: true + citation_package: natbib + latex_engine: xelatex --- ```{r setup, include=FALSE} @@ -283,10 +293,15 @@ Perhaps the first important question to ask of these groups is, where are they? # Row 1 plot using polygons from admin_lev1 and row 2 plot using ploygons from admin_lev2 # 3. Need to clip choropleth polygons to buildings shapefile +# tidy data admin_lev1_gathered <- gather(admin_lev1_sf, value="number", ecs_count) - + +# plot simple choropleth, as here: https://www.r-graph-gallery.com/327-chloropleth-map-from-geojson-with-ggplot2/ + myplot <- ggplot() + geom_sf(data = admin_lev1_gathered) + geom_point(data=as.data.frame(ecs), aes(x=X, y=Y)) +# plot as + ggsave("figures/admin_choropleth_ecs.pdf") ``` @@ -324,6 +339,8 @@ ggplot(admin.df_gathered, aes(fill=group_type, y=number, x=name)) + # ggplot(mtcars, aes(x=as.factor(cyl), fill=as.factor(cyl) )) + geom_bar() + coord_flip() + +# add bubbleplot on map, as here: https://www.r-graph-gallery.com/330-bubble-map-with-ggplot2/ or here: https://www.r-graph-gallery.com/177-map-with-proportional-symbols/ ``` @@ -335,6 +352,7 @@ We can compare the representation in these various regions against our compariso [Figure 4, normalised by PointX data; also including agricultural parishes etc. as above] +# plot as chlorogram: https://www.r-graph-gallery.com/331-basic-cartogram/ # Appendix A ```{r pander_admin_table}