我对R闪亮编码很新。我想通过以下代码计算ValueBox中的总和但是收到错误“找不到函数”%>%“”
请帮我把这个动态化。数据可在以下链接中找到: https://drive.google.com/open?id=0B0nKk-ptPFY1aWljWGk3bWVObDg
#UI
library(shiny)
library(shinydashboard)
dashboardPage(
dashboardHeader(title = "BCL"),
dashboardSidebar(width = 200,
selectInput("typeType",
label = em("Select Type",style="text-align:center;color:#FFA319;font-size:100%"),
unique(outcome_data$Type),selected = 'WINE', multiple = TRUE),
selectInput("typeSubtype",
label = em("Select Subtype",style="text-align:center;color:#FFA319;font-size:100%"),
unique(outcome_data$Subtype),selected = "TABLE WINE RED", multiple = TRUE),
selectInput('typeCountry',em('Choose Country',style="text-align:center;color:#FFA319;font-size:100%"),
unique(outcome_data$Country),selected = "CANADA", multiple = TRUE),
selectInput('typeName',em('Choose Name',style="text-align:center;color:#FFA319;font-size:100%"),
unique(outcome_data$Name),selected = "COPPER MOON - MALBEC", multiple = TRUE)
),
dashboardBody(
fluidRow(
valueBoxOutput("DollarBox")
)
)
)
#Server
library(shiny)
outcome_data=read.csv("C:/Users/Archika Kaushik/Documents/bcl-data.csv",stringsAsFactors = F)
shinyServer(function(input, output)
{
output$DollarBox <- renderValueBox({
filtered <-
outcome_data %>%
filter(Type == input$typeType,
Subtype == input$typeSubtype,
Country == input$typeCountry,
Name == input$typeName)
valueBox(sum(filtered$Price), "Price", icon = icon("list"), color = "purple")
})
})