Also available as:

Topics: Introduction to Mapping in Scholar

Motivation: In many applications of data science, in many disciplines, mapping plays a key role. Today we learn how to make maps in R. They are relatively simple to create. Maps are the first concept in data visualization that we will study.

Context: After learning the skills in this project, we will be able to make maps of anywhere in the world that Google Maps are available. We will also have control over the zoom factor, and we will be able to add points to the maps, according to the latitude and longitude for points of interest.

Scope: R is the software that we will use throughout the semester. It is a powerful tool in its own right, but it can also be used to call other tools. So we can view R as the glue that enables us to stitch together many of the other tools that we learn this year. Moreover, R has approximately 15,000 packages, which are used in every conceivable discipline and area of study. These packages are available to download and use, at no cost. https://cran.r-project.org/web/packages/

Question 1: Building a Map of AirBnB Listings in Los Angeles

Try the following inside the Scholar environment.

1a. Open the Terminal in Scholar.

1b. Open RStudio by typing the following in the terminal:

ml gcc

ml rstudio

rstudio

1c. Open the following R file: /class/datamine/data/examples/LAmaps.R

1d. Save this file in your home directory on Scholar.

1e. Run the commands in R and display the map of AirBnB listings in Los Angeles.

You do not need to understand all of the R code. We are just learning with a comprehensive example.

Hint 1: You can run each command in RStudio by typing Control-Enter (also called Control-Return)

Hint 2: If the font in your RStudio application looks strange, read the section about how to fix this, in the computer FAQ on The Data Mine website https://datamine.purdue.edu/computing-faq.html

Question 2: Getting Your Own Google Maps API Key

2a. First load this URL:

https://google.secure.force.com/GCPEDU?cid=SX1tU%2Fw1ZbMTo0VdyFTNzwBCEeeh5KQ7xk5%2Bi273beHLpPDcHt9bEzC3lEfguSWJ

or, if we run out of licenses there, use this link:

https://google.secure.force.com/GCPEDU?cid=GHTlKXA9WVqT7vBf5tRDglTU4InEPt0ivXWMJ40OnTbIlRC0jWgm%2BcQ%2FLqvf2qIo

2b. Then follow the instructions here, to get your own Google Maps API Key.

https://datamine.purdue.edu/information/project2getAPIkey.pdf

Question 3: Creating Your Own Map of AirBnB Listings in London

You ONLY need to submit your answers to Question 3a for this project. You submit it at this URL: https://classroom.github.com/a/zmR6TLQT using the instructions found in the GitHub Classroom instructions folder on Blackboard.

3a. Modify the code from /class/datamine/data/examples/LAmaps.R to use the data about London, and to use your own Google Maps API Key, instead of Dr Wardโ€™s key. You will also need to change the location of the center of the map, so that it is not centered at Los Angeles but instead at London. This is contained in the line with as.numeric(geocode("London")). If you want to, you can also change the zoom from 9 to 10.

Submit the code that makes the map of the AirBnB listings from London.