Please follow the instructions

Programming

### Question Description

output: html_document

---

```{r setup, include=FALSE}

knitr::opts_chunk\$set(echo = FALSE)

library(knitr)

```

## Introduction

Road Trip! After the extensive social distancing, you have decided to take road trip tour the country and visit friends. You want to map out your route to decide the best path.

```{r message=FALSE, warning=FALSE}

# recommended packages

library(dplyr)

library(ggplot2)

library(gridExtra)

library(maps)

```

## Set Up

Name | City

------------- | -------------

Luke | Denver CO

Rachel | Dallas TX

Vicki | Columbia MO

Brent | Phoenix AZ

* Create a data frame (df) for the 4 friends you want to visit (you can use different names & cities that are available on us.cities!)

* Join (or merge) df with 'us.cities' data from the maps package to get the city pop, latitude and longitude

## Questions

1. What is the mean and median population for the cities listed? Output a html table the kable function

2. Work to recreate the 3 different route graphic using ggplots.

+ This will require creating 3 data frames (one for each route) that has the route defined as a factor and the data frame ordered by that variable.

+ Use the ggplot2 [reference site](https://ggplot2.tidyverse.org) to help adding the points, line, labels and borders. For example, here is the reference to adding [US borders](https://ggplot2.tidyverse.org/reference/borders.html)

+ Use the grid package and grid.arrange function to combine the plots into one graphic. Reference the gridextra package [vignettes](https://cran.r-project.org/web/packages/gridExtra/vignettes/arrangeGrob.html). The other option would be to rbind the data and use facet_wrap in ggplot.

3. Use the latitude and longitude to calculate the shortest route in total miles between routes A, B and C. This will require searching google for a package with a function that can calculate the distance in miles. A GOOD IDEA WOULD BE TO USE TO GOOGLE MAPS TO VALIDATE YOUR ANSWER!

Student has agreed that all tutoring, explanations, and answers provided by the tutor will be used to help in the learning process and in accordance with Studypool's honor code & terms of service.

This question has not been answered.

Create a free account to get help with this and any other question!