Thursday, January 13, 2011

Plot a FIFO in R

Recently discovered a really simple way to plot a fifo in rstats. Here's a simple example of plotting the output of your ifstat program. From one terminal do:

mkfifo ifstat_fifo
ifstat -n > ifstat_fifo

Then, in another terminal, open an R shell and do the following:

# Plot the most recent 100 seconds of inbound network traffic
> while(T){
d <- read.table(fifo("ifstat_fifo",open="read"))
x <- rbind(x,d)
x <-tail(x,100)

You may have to run it a couple times while the fifo fills with data. And here's what that looks like:


  1. Thanks for this post. However, I don't know what x is in your example. Also, I couldn't get the read.table(...) function to work but was able to use readLines(...). I'm new to R, so do you mind expanding on this post?


  2. Nice blog has been shared by you. it will be really helpful to many peoples who are all working under the technology.thank you for sharing this blog.
    R Programming Online Training|
    SAS Online Training |
    Tableau Online Training|