[R] how to generate pairwise plots with data frames - tia

From: Peter Waltman <pwaltman_at_cs.tufts.edu>
Date: Tue 07 Jun 2005 - 07:15:36 EST

hi -

sorry for a newbie question, but I've tried to go through the documentation and couldn't find anything that would address my specific need.

in a nutshell, I have a txt file containing a data matrix with 10 columns of data. I would like to generate pairwise plots of the data, i.e. 1 column against the other 9. Since this will produce 50 plots, I'd like to do it using a loop. However, I can't figure out how to do it as it seems like I have to specify the column name within the plot function.

for example, if I have:

    test <- read.delim("matrix.txt")

and then try to generate a plot of the first 2 columns via:

    plot(test[1], test[2)

I get an error message:

    Error in pmatch(x, table, duplicates.ok) :

            argument is not of mode character

but if I specify these columns by their column headers, i.e.:

    plot(Control_200, Control_201)

it works just fine. However, with 10 columns, this will produce ~ 50 pairwise plots, so I'd really like to figure out how to automate this. I've tried getting the names of the data frame and using those, i.e.:

    plot(test$myNames[1], test$myNames[2])

but that doesn't work either as the myNames members are strings, not the variables themselves (I believe).

is it possible to get a listing of the variables themselve, not the names and work off of those?

thanks to anyone who can help shed some light on this,

Peter Waltman

R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Tue Jun 07 07:19:27 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:32:23 EST