1

This code is supposed to prepare a subset of data selected basing on user input for plotting usinng dygraph.

selectedData <- reactive({
 omdata<-mdata[ mdata$Col1 %in% input$col1,];
 tomdata<-omdata[omdata$Col2 %in% input$col2,];
 dtomdata<-tomdata[tomdata$Date >= input$daterange[1] & tomdata$Date <= input$daterange[2], ];
 # Conversion to xts needed by dygraphs
 dtomdata <- xts(dtomdata, dtomdata$Date); #sticking timestamps to the frame
 dtomdata$Date = NULL #!!!THIS CAUSES TROUBLE!!!removing the column that was the source of timestamps
})

output$text1 <- renderTable({ 
 selectedData()  ## For the purpose of debug output to see what is dygraph trying to plot
})

Somehow the last line, instead of removing just one column, sets whole xts frame to zero. Why does that happen?

Krzysiek Setlak
  • 311
  • 1
  • 4
  • 16

0 Answers0