USA

All warehouses in the USA

## Boxplot USA

Denver

Denver warehouses

Boxplot Denver

Map

Location of warehouses (needs checking)

---
title: "Denver"
output:
  flexdashboard::flex_dashboard:
    orientation: columns
    vertical_layout: fill
    date: "12/10/2020"
    source_code: embed
    output: html_document
  prettydoc::html_pretty: default
---


```{r, include = FALSE}
library(ggplot2)
library(dplyr)
library(flexdashboard)
library(tidyverse)
library(janitor)
library(usethis)
library(devtools)
library(plotly)
library(rlang)
```


```{r setup, include=FALSE}
knitr::opts_chunk$set(warning = FALSE, message = FALSE)
library(readxl)
geo_usa_4 <- read_excel("D:/google_drive/00_city_logistics/02_datasets/real_estate/usa_raw/geocoding/geo_usa_4.xlsx")
View(geo_usa_4)

names(geo_usa_4) <- c("county", "address", "city", "state", "country", "sf_price", "m2_price", "area_sf", "area_m2", "lat", "long") 
```

USA
=======================================================================

## All warehouses in the USA

```{r message=FALSE, warning=FALSE}
plotly::plot_ly(data = geo_usa_4, x = ~area_m2, y = ~m2_price) %>%
layout(xaxis = list(title = "Warehouse area"),
       yaxis = list(title = "price per square meter per month"))

```
## Boxplot USA

```{r}
plot_ly(geo_usa_4, x = ~m2_price, y = ~area_m2) %>%
  add_boxplot(color = ~county) %>%
  layout(xaxis = list(title = "Warehouse area"),
         yaxis = list(title = "price per square meter per month"))
```


Denver
=======================================================================

## Denver warehouses

```{r}
library(dplyr)
geo_usa_5 <- geo_usa_4 %>%
  dplyr::filter(county == "denver") 

plotly::plot_ly(data = geo_usa_5, x = ~area_m2, y = ~m2_price) %>%
layout(xaxis = list(title = "Warehouse area"),
         yaxis = list(title = "price per square meter per month"))

```

## Boxplot Denver

```{r}
plot_ly(geo_usa_5, x = ~m2_price, y = ~area_m2) %>%
  add_boxplot(color = ~county) %>%
  layout(xaxis = list(title = "Warehouse area"),
         yaxis = list(title = "price per square meter per month"))
```

Map
=======================================================================

## Location of warehouses (needs checking)

```{r}
library(plotly)
df <- geo_usa_4

# geo styling
g <- list(
  scope = 'usa',
 projection = list(type = 'albers usa'),
  showland = TRUE,
  showlakes = FALSE,
  landcolor = toRGB("gray95"),
  subunitcolor = toRGB("gray85"),
  countrycolor = toRGB("gray85"),
  countrywidth = 0.5,
  subunitwidth = 0.5
)

fig <- plot_geo(df, lat = ~long, lon = ~lat)
fig <- fig %>% add_markers(
    text = ~paste(paste("Price:", m2_price), sep = "
"), color = ~m2_price, symbol = I("square"), size = I(8), hoverinfo = "text" ) fig <- fig %>% colorbar(title = "Price
") fig <- fig %>% layout( title = 'Warehouse price ($/m2/mo)
', geo = g ) fig ```