官术网_书友最值得收藏!

The Gapminder application

Now that we've got the basics, let's build a full application. Before we proceed, note that we will need to install a few packages—tidyverse, gapminder, leaflet, and ggmap. Each can be installed from CRAN (the official R package repository) using the code phrases install.packages("tidyverse"), install.packages("gapminder"), and so on. We will not install ggmap this way, though. At the time of writing, there is a bug in the CRAN version. We'll install the dev version instead, as shown in the following code:

install.packages("devtools")
library(devtools)
devtools::install_github("dkahle/ggmap")

The application is pretty simple to get us started, but it illustrates several important methods and principles in Shiny. It features tabbed output, which allows the user to select different inputs or groups, which are each kept on a separate tab. It features the standard Shiny layout—the sidebar layout—with inputs at the left and outputs in the main section. The three tabs give a textual summary, a line graph showing life expectancy over time, and a map with circles scaled to the life expectancy in each country. The application looks like the following screenshot:

主站蜘蛛池模板: 旬阳县| 大竹县| 白水县| 大荔县| 龙口市| 正镶白旗| 浮山县| 永兴县| 宣恩县| 崇义县| 临洮县| 平原县| 紫金县| 习水县| 绥芬河市| 屏边| 东丰县| 阳信县| 高州市| 井冈山市| 富平县| 吕梁市| 肥东县| 大英县| 贡嘎县| 三台县| 武冈市| 商都县| 桃园县| 清丰县| 大名县| 永寿县| 西宁市| 凌源市| 永福县| 永定县| 措美县| 阿巴嘎旗| 珠海市| 大足县| 兴安盟|