Error: Expected an object with class 'shiny.tag' while rendering ValueBox
I have two R files in my shiny dashboard app. global.R and app.R.
Under global.R I have the following structure.
ShedArea <- c("Shed 1", "Shed 2", "Shed 3","Shed 4")
SeedsReceived_KGS <- c(14,24,8,19)
DF <- data.frame(ShedArea,SeedsReceived_KGS,stringsAsFactors = FALSE)
shed_area <- unique(DF$ShedArea)
mean_seeds <- mean(DF$SeedsReceived_KGS)
In app.R, I've implemented a pickerInput where one can select a single or all sheds, and a valueBoxOutput to display the mean of the selected shed or of all sheds.
Contents of app.R.
UI
source("global.R")
valueBoxOutput("av_seeds_received")
pickerInput(inputId = "shed", label = "Select Shed", choices = shed_area, selected = shed_area, options = list(`actions-box` = TRUE),multiple = TRUE)
Server
output$av_seeds_received <- renderValueBox(
filter(DF, ShedArea==input$shed) %>%
valueBox("Seeds Received", round(mean_seeds, digits=2))
)
When I runApp(), I get an Error: Expected an object with class 'shiny.tag'.
How do I go about resolving this, so that when the a shed is selected, the mean value of seeds received is displayed?
r shiny dplyr shinydashboard
add a comment |
I have two R files in my shiny dashboard app. global.R and app.R.
Under global.R I have the following structure.
ShedArea <- c("Shed 1", "Shed 2", "Shed 3","Shed 4")
SeedsReceived_KGS <- c(14,24,8,19)
DF <- data.frame(ShedArea,SeedsReceived_KGS,stringsAsFactors = FALSE)
shed_area <- unique(DF$ShedArea)
mean_seeds <- mean(DF$SeedsReceived_KGS)
In app.R, I've implemented a pickerInput where one can select a single or all sheds, and a valueBoxOutput to display the mean of the selected shed or of all sheds.
Contents of app.R.
UI
source("global.R")
valueBoxOutput("av_seeds_received")
pickerInput(inputId = "shed", label = "Select Shed", choices = shed_area, selected = shed_area, options = list(`actions-box` = TRUE),multiple = TRUE)
Server
output$av_seeds_received <- renderValueBox(
filter(DF, ShedArea==input$shed) %>%
valueBox("Seeds Received", round(mean_seeds, digits=2))
)
When I runApp(), I get an Error: Expected an object with class 'shiny.tag'.
How do I go about resolving this, so that when the a shed is selected, the mean value of seeds received is displayed?
r shiny dplyr shinydashboard
First of all you needfilter(DF, ShedArea %in% input$shed). See if this fixes the error. Also you need to calculatemean_seedsinsiderenderValueBox.
– Shree
Nov 13 '18 at 5:46
@Shree, I've made the adjustments and the value is appearing. mean of all sheds. However, when you select one shed, the mean value doesn't change. The filter isn't implementing. Might you know what could be the issue?
– Sayari
Nov 13 '18 at 8:19
add a comment |
I have two R files in my shiny dashboard app. global.R and app.R.
Under global.R I have the following structure.
ShedArea <- c("Shed 1", "Shed 2", "Shed 3","Shed 4")
SeedsReceived_KGS <- c(14,24,8,19)
DF <- data.frame(ShedArea,SeedsReceived_KGS,stringsAsFactors = FALSE)
shed_area <- unique(DF$ShedArea)
mean_seeds <- mean(DF$SeedsReceived_KGS)
In app.R, I've implemented a pickerInput where one can select a single or all sheds, and a valueBoxOutput to display the mean of the selected shed or of all sheds.
Contents of app.R.
UI
source("global.R")
valueBoxOutput("av_seeds_received")
pickerInput(inputId = "shed", label = "Select Shed", choices = shed_area, selected = shed_area, options = list(`actions-box` = TRUE),multiple = TRUE)
Server
output$av_seeds_received <- renderValueBox(
filter(DF, ShedArea==input$shed) %>%
valueBox("Seeds Received", round(mean_seeds, digits=2))
)
When I runApp(), I get an Error: Expected an object with class 'shiny.tag'.
How do I go about resolving this, so that when the a shed is selected, the mean value of seeds received is displayed?
r shiny dplyr shinydashboard
I have two R files in my shiny dashboard app. global.R and app.R.
Under global.R I have the following structure.
ShedArea <- c("Shed 1", "Shed 2", "Shed 3","Shed 4")
SeedsReceived_KGS <- c(14,24,8,19)
DF <- data.frame(ShedArea,SeedsReceived_KGS,stringsAsFactors = FALSE)
shed_area <- unique(DF$ShedArea)
mean_seeds <- mean(DF$SeedsReceived_KGS)
In app.R, I've implemented a pickerInput where one can select a single or all sheds, and a valueBoxOutput to display the mean of the selected shed or of all sheds.
Contents of app.R.
UI
source("global.R")
valueBoxOutput("av_seeds_received")
pickerInput(inputId = "shed", label = "Select Shed", choices = shed_area, selected = shed_area, options = list(`actions-box` = TRUE),multiple = TRUE)
Server
output$av_seeds_received <- renderValueBox(
filter(DF, ShedArea==input$shed) %>%
valueBox("Seeds Received", round(mean_seeds, digits=2))
)
When I runApp(), I get an Error: Expected an object with class 'shiny.tag'.
How do I go about resolving this, so that when the a shed is selected, the mean value of seeds received is displayed?
r shiny dplyr shinydashboard
r shiny dplyr shinydashboard
asked Nov 13 '18 at 5:30
SayariSayari
60451231
60451231
First of all you needfilter(DF, ShedArea %in% input$shed). See if this fixes the error. Also you need to calculatemean_seedsinsiderenderValueBox.
– Shree
Nov 13 '18 at 5:46
@Shree, I've made the adjustments and the value is appearing. mean of all sheds. However, when you select one shed, the mean value doesn't change. The filter isn't implementing. Might you know what could be the issue?
– Sayari
Nov 13 '18 at 8:19
add a comment |
First of all you needfilter(DF, ShedArea %in% input$shed). See if this fixes the error. Also you need to calculatemean_seedsinsiderenderValueBox.
– Shree
Nov 13 '18 at 5:46
@Shree, I've made the adjustments and the value is appearing. mean of all sheds. However, when you select one shed, the mean value doesn't change. The filter isn't implementing. Might you know what could be the issue?
– Sayari
Nov 13 '18 at 8:19
First of all you need
filter(DF, ShedArea %in% input$shed). See if this fixes the error. Also you need to calculate mean_seeds inside renderValueBox.– Shree
Nov 13 '18 at 5:46
First of all you need
filter(DF, ShedArea %in% input$shed). See if this fixes the error. Also you need to calculate mean_seeds inside renderValueBox.– Shree
Nov 13 '18 at 5:46
@Shree, I've made the adjustments and the value is appearing. mean of all sheds. However, when you select one shed, the mean value doesn't change. The filter isn't implementing. Might you know what could be the issue?
– Sayari
Nov 13 '18 at 8:19
@Shree, I've made the adjustments and the value is appearing. mean of all sheds. However, when you select one shed, the mean value doesn't change. The filter isn't implementing. Might you know what could be the issue?
– Sayari
Nov 13 '18 at 8:19
add a comment |
1 Answer
1
active
oldest
votes
Here's what you probably need -
output$av_seeds_received <- renderValueBox(
df <- filter(DF, ShedArea %in% input$shed)
mean_seeds <- mean(df$SeedsReceived_KGS, na.rm = T) %>% round(2)
valueBox(mean_seeds, "Seeds Received")
)
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53274403%2ferror-expected-an-object-with-class-shiny-tag-while-rendering-valuebox%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Here's what you probably need -
output$av_seeds_received <- renderValueBox(
df <- filter(DF, ShedArea %in% input$shed)
mean_seeds <- mean(df$SeedsReceived_KGS, na.rm = T) %>% round(2)
valueBox(mean_seeds, "Seeds Received")
)
add a comment |
Here's what you probably need -
output$av_seeds_received <- renderValueBox(
df <- filter(DF, ShedArea %in% input$shed)
mean_seeds <- mean(df$SeedsReceived_KGS, na.rm = T) %>% round(2)
valueBox(mean_seeds, "Seeds Received")
)
add a comment |
Here's what you probably need -
output$av_seeds_received <- renderValueBox(
df <- filter(DF, ShedArea %in% input$shed)
mean_seeds <- mean(df$SeedsReceived_KGS, na.rm = T) %>% round(2)
valueBox(mean_seeds, "Seeds Received")
)
Here's what you probably need -
output$av_seeds_received <- renderValueBox(
df <- filter(DF, ShedArea %in% input$shed)
mean_seeds <- mean(df$SeedsReceived_KGS, na.rm = T) %>% round(2)
valueBox(mean_seeds, "Seeds Received")
)
answered Nov 13 '18 at 14:49
ShreeShree
3,3911323
3,3911323
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53274403%2ferror-expected-an-object-with-class-shiny-tag-while-rendering-valuebox%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
First of all you need
filter(DF, ShedArea %in% input$shed). See if this fixes the error. Also you need to calculatemean_seedsinsiderenderValueBox.– Shree
Nov 13 '18 at 5:46
@Shree, I've made the adjustments and the value is appearing. mean of all sheds. However, when you select one shed, the mean value doesn't change. The filter isn't implementing. Might you know what could be the issue?
– Sayari
Nov 13 '18 at 8:19