—
title: “仪表板”
author: “Yi”
date: “2020/7/14”
output: flexdashboard::flex_dashboard
—
“`{r setup, include=FALSE}
knitr::opts_chunk$set(echo = T)
library(tidyverse)
library(patchwork)
sm <- diamonds %>% slice_sample(n = 1000)
“`
# 地图
– 东北大学
“`{r}
library(leaflet)
leaflet() %>%
addTiles() %>% #增加一个平铺的图层
setView(lng = 123.417933, lat = 41.649108,zoom = 15) %>%
addMarkers(123.417933,41.649108, popup = ‘东北大学-浑南’)
“`
# 钻石数据集
## 绘图列
### 柱形图
“`{r echo = F}
sm %>%
ggplot() + geom_bar(aes(cut, fill = cut))
“`
### 箱线图与散点图
“`{r echo = F}
p1 <-
sm %>%
ggplot() + geom_boxplot(aes(cut, carat, fill = cut))
p2 <-
sm %>%
ggplot() + geom_point(aes(carat, price, color = cut))
p1 + p2
“`
## 数据列
### 钻石数据
“`{r}
sm %>%
slice_head(n = 100) %>%
DT::datatable(caption = ‘钻石数据集’)
“`