---
title: "日本社会心理学会第57回大会＠関西学院大学グルメマップ"
output: 
  flexdashboard::flex_dashboard:
    orientation: columns
    vertical_layout: fill
---

```{r setup, include=FALSE}
library(flexdashboard)
library(dplyr)
library(leaflet)
library(DT)
df <- read.csv("sp2016_map.csv", stringsAsFactors = FALSE)
```

Column {data-width=60%}
-----------------------------------------------------------------------

### 店舗マップ(マーカーをクリックするとポップアップで情報が出ます)

```{r}
leaflet(df) %>% 
  addTiles() %>% 
  addMarkers(~lon,~lat,options=markerOptions(title=~sp_name),popup=~popup, label=~as.character(X), labelOptions=labelOptions(noHide=TRUE, opacity=0.7)) %>% 
  addMiniMap(position="bottomleft") %>% 
  addScaleBar(position="bottomleft")
```

Column {data-width=40%}
-----------------------------------------------------------------------

### 店舗一覧(検索などもできます)

```{r}
df %>% 
  select(X, area, sp_name, genre, sp_score, sp_tel, sp_address) %>% 
  mutate_at(vars(area, sp_name),as.factor) %>% 
  datatable(rownames=FALSE, colnames=c("番号","エリア", "店名", "ジャンル", "☆", "TEL", "住所"),
            filter='top', options=list(autoWidth=TRUE))
```

