Flag invalid points in time-series data table from plot in R Shiny










0















I am trying to build a Shiny App that will do the following:



  1. Read a time-series data set from a database (e.g. DateTime, Value, Status), where Status flags whether a point is valid and be plotted

  2. Create a time-series plot of that data (with only Status = Valid points showing).

  3. Create a data table in the interface showing the data that are being plotted

  4. Allow for the user to review the data in the plot and then "flag out" points by setting the Status in the table to invalid

Steps 1-3 above I understand how to do, but I'm looking for suggestions on how to implement the 4th step. Can Shiny have an interactive table where if a user sets the stats flag, it will react and redraw the plot?



The idea here is to make an interactive data cleaning tool for time-series data recorded from an instrument that often will have bad data points in it.



Thanks










share|improve this question






















  • Your post structure and content are great but a small working example that focuses on the 4th point will help you get answers.

    – Shree
    Nov 14 '18 at 22:22















0















I am trying to build a Shiny App that will do the following:



  1. Read a time-series data set from a database (e.g. DateTime, Value, Status), where Status flags whether a point is valid and be plotted

  2. Create a time-series plot of that data (with only Status = Valid points showing).

  3. Create a data table in the interface showing the data that are being plotted

  4. Allow for the user to review the data in the plot and then "flag out" points by setting the Status in the table to invalid

Steps 1-3 above I understand how to do, but I'm looking for suggestions on how to implement the 4th step. Can Shiny have an interactive table where if a user sets the stats flag, it will react and redraw the plot?



The idea here is to make an interactive data cleaning tool for time-series data recorded from an instrument that often will have bad data points in it.



Thanks










share|improve this question






















  • Your post structure and content are great but a small working example that focuses on the 4th point will help you get answers.

    – Shree
    Nov 14 '18 at 22:22













0












0








0








I am trying to build a Shiny App that will do the following:



  1. Read a time-series data set from a database (e.g. DateTime, Value, Status), where Status flags whether a point is valid and be plotted

  2. Create a time-series plot of that data (with only Status = Valid points showing).

  3. Create a data table in the interface showing the data that are being plotted

  4. Allow for the user to review the data in the plot and then "flag out" points by setting the Status in the table to invalid

Steps 1-3 above I understand how to do, but I'm looking for suggestions on how to implement the 4th step. Can Shiny have an interactive table where if a user sets the stats flag, it will react and redraw the plot?



The idea here is to make an interactive data cleaning tool for time-series data recorded from an instrument that often will have bad data points in it.



Thanks










share|improve this question














I am trying to build a Shiny App that will do the following:



  1. Read a time-series data set from a database (e.g. DateTime, Value, Status), where Status flags whether a point is valid and be plotted

  2. Create a time-series plot of that data (with only Status = Valid points showing).

  3. Create a data table in the interface showing the data that are being plotted

  4. Allow for the user to review the data in the plot and then "flag out" points by setting the Status in the table to invalid

Steps 1-3 above I understand how to do, but I'm looking for suggestions on how to implement the 4th step. Can Shiny have an interactive table where if a user sets the stats flag, it will react and redraw the plot?



The idea here is to make an interactive data cleaning tool for time-series data recorded from an instrument that often will have bad data points in it.



Thanks







r shiny






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 14 '18 at 22:17









DarwinsBeardDarwinsBeard

2116




2116












  • Your post structure and content are great but a small working example that focuses on the 4th point will help you get answers.

    – Shree
    Nov 14 '18 at 22:22

















  • Your post structure and content are great but a small working example that focuses on the 4th point will help you get answers.

    – Shree
    Nov 14 '18 at 22:22
















Your post structure and content are great but a small working example that focuses on the 4th point will help you get answers.

– Shree
Nov 14 '18 at 22:22





Your post structure and content are great but a small working example that focuses on the 4th point will help you get answers.

– Shree
Nov 14 '18 at 22:22












1 Answer
1






active

oldest

votes


















0














Here is a solution using library(DT).
Type '0' in the 'plot'-column to remove the datapoint from the plot.



library(shiny)
library(DT)

shinyApp(
ui = fluidPage(DTOutput('myTable'),
plotOutput("myPlot")),
server = function(input, output)
output$tbl = renderDT(iris,
options = list(lengthChange = FALSE),
editable = TRUE)

myData = data.frame(y = 1:10, plot = 1)

output$myTable = renderDT(myData, selection = 'none', editable = TRUE)

proxy = dataTableProxy('myTable')

observeEvent(input$myTable_cell_edit,
info = input$myTable_cell_edit
str(info)
i = info$row
j = info$col
v = info$value
myData[i, j] <<- DT::coerceValue(v, myData[i, j])
replaceData(proxy, myData, resetPaging = FALSE) # important
)

output$myPlot <- renderPlot(
input$myTable_cell_edit
plot(myData$y[myData$plot > 0], myData$y[myData$plot > 0])
)


)


For further information see this.






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%2f53309570%2fflag-invalid-points-in-time-series-data-table-from-plot-in-r-shiny%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









    0














    Here is a solution using library(DT).
    Type '0' in the 'plot'-column to remove the datapoint from the plot.



    library(shiny)
    library(DT)

    shinyApp(
    ui = fluidPage(DTOutput('myTable'),
    plotOutput("myPlot")),
    server = function(input, output)
    output$tbl = renderDT(iris,
    options = list(lengthChange = FALSE),
    editable = TRUE)

    myData = data.frame(y = 1:10, plot = 1)

    output$myTable = renderDT(myData, selection = 'none', editable = TRUE)

    proxy = dataTableProxy('myTable')

    observeEvent(input$myTable_cell_edit,
    info = input$myTable_cell_edit
    str(info)
    i = info$row
    j = info$col
    v = info$value
    myData[i, j] <<- DT::coerceValue(v, myData[i, j])
    replaceData(proxy, myData, resetPaging = FALSE) # important
    )

    output$myPlot <- renderPlot(
    input$myTable_cell_edit
    plot(myData$y[myData$plot > 0], myData$y[myData$plot > 0])
    )


    )


    For further information see this.






    share|improve this answer





























      0














      Here is a solution using library(DT).
      Type '0' in the 'plot'-column to remove the datapoint from the plot.



      library(shiny)
      library(DT)

      shinyApp(
      ui = fluidPage(DTOutput('myTable'),
      plotOutput("myPlot")),
      server = function(input, output)
      output$tbl = renderDT(iris,
      options = list(lengthChange = FALSE),
      editable = TRUE)

      myData = data.frame(y = 1:10, plot = 1)

      output$myTable = renderDT(myData, selection = 'none', editable = TRUE)

      proxy = dataTableProxy('myTable')

      observeEvent(input$myTable_cell_edit,
      info = input$myTable_cell_edit
      str(info)
      i = info$row
      j = info$col
      v = info$value
      myData[i, j] <<- DT::coerceValue(v, myData[i, j])
      replaceData(proxy, myData, resetPaging = FALSE) # important
      )

      output$myPlot <- renderPlot(
      input$myTable_cell_edit
      plot(myData$y[myData$plot > 0], myData$y[myData$plot > 0])
      )


      )


      For further information see this.






      share|improve this answer



























        0












        0








        0







        Here is a solution using library(DT).
        Type '0' in the 'plot'-column to remove the datapoint from the plot.



        library(shiny)
        library(DT)

        shinyApp(
        ui = fluidPage(DTOutput('myTable'),
        plotOutput("myPlot")),
        server = function(input, output)
        output$tbl = renderDT(iris,
        options = list(lengthChange = FALSE),
        editable = TRUE)

        myData = data.frame(y = 1:10, plot = 1)

        output$myTable = renderDT(myData, selection = 'none', editable = TRUE)

        proxy = dataTableProxy('myTable')

        observeEvent(input$myTable_cell_edit,
        info = input$myTable_cell_edit
        str(info)
        i = info$row
        j = info$col
        v = info$value
        myData[i, j] <<- DT::coerceValue(v, myData[i, j])
        replaceData(proxy, myData, resetPaging = FALSE) # important
        )

        output$myPlot <- renderPlot(
        input$myTable_cell_edit
        plot(myData$y[myData$plot > 0], myData$y[myData$plot > 0])
        )


        )


        For further information see this.






        share|improve this answer















        Here is a solution using library(DT).
        Type '0' in the 'plot'-column to remove the datapoint from the plot.



        library(shiny)
        library(DT)

        shinyApp(
        ui = fluidPage(DTOutput('myTable'),
        plotOutput("myPlot")),
        server = function(input, output)
        output$tbl = renderDT(iris,
        options = list(lengthChange = FALSE),
        editable = TRUE)

        myData = data.frame(y = 1:10, plot = 1)

        output$myTable = renderDT(myData, selection = 'none', editable = TRUE)

        proxy = dataTableProxy('myTable')

        observeEvent(input$myTable_cell_edit,
        info = input$myTable_cell_edit
        str(info)
        i = info$row
        j = info$col
        v = info$value
        myData[i, j] <<- DT::coerceValue(v, myData[i, j])
        replaceData(proxy, myData, resetPaging = FALSE) # important
        )

        output$myPlot <- renderPlot(
        input$myTable_cell_edit
        plot(myData$y[myData$plot > 0], myData$y[myData$plot > 0])
        )


        )


        For further information see this.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Nov 14 '18 at 23:42

























        answered Nov 14 '18 at 23:32









        ismirsehregalismirsehregal

        1,7601212




        1,7601212





























            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%2f53309570%2fflag-invalid-points-in-time-series-data-table-from-plot-in-r-shiny%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







            這個網誌中的熱門文章

            How to read a connectionString WITH PROVIDER in .NET Core?

            Node.js Script on GitHub Pages or Amazon S3

            Museum of Modern and Contemporary Art of Trento and Rovereto