title: R: get sum from selected Input
body: <p>I am relative new to R and trying to learn on my own.</p>
  
  <p>I want to create in a shiny dashboard a select-field where i can choose products of my Data (.xls) and get a sum returned.</p>
  
  <p>The Input is via <em>selectInput</em> and <em>selectize</em>. This is the part, which works :)</p>
  
  <p>If I choose 1 product i'll get the calories of this product back...so far.</p>
  
  <p>My Problem is that wanna choose more products then 1 and get the sum of the calories. How do i have to identify/search the products of the input field in my table and how do i get the sum of it?</p>
  
  <p>Thanks a lot for your help!</p>
  
  <p>PS: Do you need further info about file? only two columns are important for this: product and calories.</p>
  
  <pre><code>library(dplyr)
  library(plotly)
  library(readxl)
  library(shiny)
  library(shinydashboard)
  
  # Daten einlesen
  McDaten &lt;- read_excel("~/Desktop/McDaten.xlsx")
  McDaten$kcal &lt;- McDaten$`kcal (100g)`
  
  ui &lt;- dashboardPage(
  skin="red",
  dashboardHeader(title = "Analytics Dashboard", titleWidth = 290),
  dashboardSidebar(
  width = 290,
  sidebarMenu(
    menuItem("Virtuelles Menü", tabName = "charts", icon = icon("cutlery"))
  
  )
    ),
  
    dashboardBody(
  
  
  tabItems(
  
    tabItem(tabName = "charts",
            fluidPage(
              br(),
              fluidRow(
                column(4,
                       selectInput('in6', 'Menü', McDaten$Produkt, multiple=TRUE, selectize=TRUE)),
                column(4,infoBoxOutput("progressBox"))
              )
            )
  
    ))))
  
  
  server &lt;- function(input, output) {
  
    output$progressBox &lt;- renderInfoBox({
      b &lt;- McDaten %&gt;%
    select(`kcal (Portion)`, Produkt) %&gt;%
    filter(McDaten$Produkt %in% input$in6) %&gt;%
    summarise(`kcal (Portion)`)
  
  infoBox(
    "Progress", paste0(b, " kcal"), icon = icon("list"),
    color = "purple", fill = TRUE
  )
    })
  
  }
  
  
  shinyApp(ui, server)
  </code></pre>