r语言r-shiny
by AMR
通过AMR
使用Shiny和R构建您的第一个Web应用程序仪表板 (Build your first web app dashboard using Shiny and R)
One of the beautiful gifts that R has (that Python missed,until dash) is Shiny. Shiny is an R package that makes it easy to build interactive web apps straight from R. Dashboards are popular since they are good in helping businesses make insights out of the existing data.
R拥有的漂亮礼物之一(Python漏掉了,直到破折号 )是Shiny 。 Shiny是一个R软件包,可以很容易地从R直接构建交互式Web应用程序。 仪表板之所以受欢迎,是因为它们很好地帮助企业从现有数据中获得洞察。
In this post, we will see how to leverage Shiny to build a simple sales revenue dashboard. You will need R installed.
在这篇文章中,我们将看到如何利用Shiny构建一个简单的销售收入仪表板。 您将需要安装R。
在R中加载软件包 (Loading packages in R)
The packages you need must be downloaded separately, and installed using R. All the packages listed below can be directly installed from CRAN, you can choose which CRAN mirror to use. Package dependencies will also be downloaded and installed by default.
您需要的软件包必须单独下载,并使用R 安装 。 可以从CRAN直接安装下面列出的所有软件包,您可以选择要使用的CRAN镜像。 默认情况下,还将下载和安装软件包依赖项。
Once the packages are installed, you need to load them into your R session. The library and require commands are used and, again, package dependencies are also loaded automatically by R.
安装软件包后,您需要将它们加载到R会话中。 使用了library和require命令,并且包依赖关系也由R自动加载。
# load the required packageslibrary(shiny)require(shinydashboard)library(ggplot2)library(dplyr)
样本输入文件 (Sample input file)
As a dashboard needs an input data to visualize, we will use recommendation.csv as an example of input data to our dashboard. As this is a .csv file, the read.csv command was used. The first row in the .csv is a title row, so header=T is used. There are two ways you can get the recommendation.csv file into your current R session:
由于仪表板需要输入数据才能可视化,因此我们将使用Recommendation.csv作为向我们的仪表板输入数据的示例。 由于这是一个.csv文件,因此使用了read.csv命令。 .csv中的第一行是标题行,因此使用header = T。 您可以通过两种方式将Recommendation.csv文件放入当前的R会话中:
Open this link —