Error: Expected an object with class 'shiny.tag' while rendering ValueBox










0















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?










share|improve this question






















  • 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















0















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?










share|improve this question






















  • 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













0












0








0








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?










share|improve this question














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






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 13 '18 at 5:30









SayariSayari

60451231




60451231












  • 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

















  • 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
















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












1 Answer
1






active

oldest

votes


















1














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")
)





share|improve this answer






















    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
    );



    );













    draft saved

    draft discarded


















    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









    1














    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")
    )





    share|improve this answer



























      1














      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")
      )





      share|improve this answer

























        1












        1








        1







        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")
        )





        share|improve this answer













        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")
        )






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 13 '18 at 14:49









        ShreeShree

        3,3911323




        3,3911323



























            draft saved

            draft discarded
















































            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.




            draft saved


            draft discarded














            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





















































            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







            Popular posts from this blog

            Kleinkühnau

            Makov (Slowakei)

            Deutsches Schauspielhaus