Within my Flexdashboard, I want to generate a valueBox displaying the sum sales values, based on a filter. I constructed the filter by using crosstalk, shiny is not an option because of the nonexistence of shiny server and there is sensitive company data. However, I tried that but there is no creating of the result number, only error "cannot coerce type character".
---
title: "testsales"
output:
flexdashboard::flex_dashboard:
orientation: columns
---
Column {data-width=150}
---------
```{r}
library(crosstalk)
library(flexdashboard)
library(dplyr)
library(plotly)
testcase_df <- data.frame(c("A", "B", "A", "B", "A", "B"), c(1,5,3,2,4,1))
colnames(testcase_df) <- c("company", "sales")
shared_data <- SharedData$new(testcase_df)
filter_select("showcase_filter", "A or B?", shared_data, testcase_df$company)
valueBox(sum(testcase_df$costs))
To sump up, I'd like to create a valueBox based on my filter. Is there any possibility to do that in combination with the crosstalk package?