dotplan

troubleshooting & performance analysis

Conditional plotting in R

Tags: , , ,

Once again plotting vSCSI trace files, this time in “R”.

Read the file “trace-2xx.csv” into a variable called vscsi_trace as a csv file using “read.csv” which splits the file into columns.

> vscsi_trace <- read.csv("/var/tmp/trace-2xx.csv")

Create a "writes" object that contains only the lines that contain the word "WRITE_REQUEST"

> writes <- subset(vscsi_trace,vscsi_trace["WRITE_REQUEST"] == "WRITE_REQUEST")

Create a "reads" object that contains only the lines in the trace that contain "READ_REQUEST"

> reads <- subset(vscsi_trace,vscsi_trace["WRITE_REQUEST"] == "READ_REQUEST")

Now create a plot with the "reads". In the trace file, I want to plot column 4.

> plot(reads[,4],cex=.1,col="green")

and finally add in the writes. Notice that we use the "points" command, not the plot command (which will create a new plot).

> points(writes[,4],cex=.1,col="red")

Here is the plot as .PDF.
r_plot_vscsi_trace

Tags: , , ,

Leave a Reply

*

© 2009 dotplan. All Rights Reserved.

This blog is powered by Wordpress and Magatheme by Bryan Helmig.