Hello,
I am receiving new data every 3 seconds, the data contains enough points to plot a new point 10x per second. I am wanting to create a plot that appears to be live stream.
My current code is this:
output$plot1 <- renderPlot({
autoInvalidate()
chuck1 <- read.csv("logfile1.txt",header=FALSE) #read data coming into logfile1.txt
autoInvalidate()
chuck1 <- na.omit(chuck1)
row_value1 <<- tail(chuck1$V1, 30) # Get most recent entries in the logfile1.txt for column 1
row_value2 <<- tail(chuck1$V2, 30) # Get most recent entries in the logfile1.txt for column 2
for(i in 1:30) #Create a for loop to cycle through the 30 entries and plot each new entry
{
row_value3 <<- row_value1[i] # set a value equal to each iteration of the for loop to be plotted later.
row_value4 <<- row_value2[i] # set a value equal to each iteration of the for loop to be plotted later.
plot(row_value3,row_value3, type="o", xlab="Time", ylab="Movement", main="Without", ylim=c(0.5,4), xlim = c(row_value1[1],row_value1[30]))
Sys.sleep(0.1) # Sleep for 0.1 second
i <- i + 1 # cycle through the loop (Unsure if i needed this just added it in just incase and tried it without it)
}
})
Currently this code results in nothing being plotted, I can see that even if it did work it would likely re-plot each time and the final thing I see is just 1 point on the screen but I don't even seem to be getting that.
I have found a few example online but none that quite match what I am looking for.
Any help would be greatly appreciated.
Thankyou