# rmarkdown::render("~/Documents/Programming/R/GeoplotR/build/instructions.Rmd")

Installation

  1. Install R and RStudio from:

https://rstudio.com/products/rstudio/download/#download

  1. Start RStudio and install the remotes package by typing the following code at the console (i.e. the '>'-symbol):

r install.packages('remotes')

  1. Now install the latest beta version of the GeoplotR package by typing the following commands at the console:

r remotes::install_github('https://github.com/pvermees/GeoplotR/')

  1. Download helpers.zip from github:pvermees/GeoplotR/build/ and unzip it to a folder on your computer. helpers.zip is an archive that contains the following four files: test.R, Template.json, Cr_Y.json and QAP.json, as well as a copy of these instructions.

Getting started

  1. You can open the three json files in RStudio. They contain the following information:

(a) lines: the coordinates of anchor points on a decision boundary

(b) line_type: solid, dashed or dotted (one for each item in lines)

(c) polygons: the coordinates of the corners of polygons whose edges overlap with the entries in lines

(d) label_coords: the coordinates of the labels that are to be placed inside each of the polygons.

(e) labels: the actual labels (one for each item in label_coords)

(f) angle: the rotation angle of the labels (one for each item label_coords)

  1. Open test.R in RStudio and click on Session $\rightarrow$ Set Working Directory $\rightarrow$ To Source File Location.

  2. Click on the Source button. This should create a PDF document on your computer, in the same folder as the test.R file. Inspect the contents of the PDF document to understand what test.R has done.

  3. Have a look at Template.json in RStudio:

(a) make any change to any number in this file

(b) save the file

(c) go back to the test.R tab

(d) click on source again.

Do you notice any change in the PDF document?

  1. test.R contains computer code in the R language. It uses two functions of the GeoplotR package named xytest and xyztest, respectively. You can read more about these functions, and about their arguments, in the built-in documentation, by typing the following code at the console:

r ?xyplot ?xyzplot

The actual job

  1. Visit Kurt Hollocher's homepage and click on any blue link in it. This should download an Excel file on your computer containing the anchor points of various binary and ternary diagrams.

  2. Your job is to use the coordinates in these Excel files to produce lines, polygons and labels that reproduce the various plots on the website. I have already finished implementing several diagrams, whose json files you can inspect at github:pvermees/GeoplotR/inst/. I would like you to make some more of these, notably:

(a) Wood, 1980

(b) Ewart, 1982

(c) Winchester and Floyd, 1977

(d) Cabanis and Lecolle, 1989

(e) Mullen, 1983

(f) Pearce and Norry, 1979

  1. The best way to build a json file is to open Template.json, save it under a different name and modify its contents. Edit test.R to test your json file. Test frequently to catch bugs. So: edit, test, edit, test, ... until the diagram looks like the one in the Excel file. I am happy to answer questions, but would advise that you try to help each other as well.


pvermees/GeoplotR documentation built on Aug. 20, 2024, 4:45 a.m.