[R] Question regarding dataframes, matrix, frame, etc...

njhuang86 njhuang86 at yahoo.com
Tue Jun 16 16:58:01 CEST 2009


Hi all,

As of now, I have a 15x8 matrix (name is "asdf"). The first seven columns
contain numbers while the last column contains a string. The class of each
column is "character". When I use the plot function to display a scatter
plot between any of the two columns, ie. plot(asdf[, 1], asdf[, 2])
everything works fine. However, if I want to use the command "pairs" to show
all combination of scatter plots between the first seven columns (without
the columns of strings), it gives me a error message telling me that I'm
passing a non-numeric arguement to 'pairs'.

As a result, I changed the original matrix into a dataframe via.
as.data.frame(asdf) so the columns are of the class "factor". However, when
I now utilize the pairs command to plot the scatterplots of the first seven
columns, the scatterplots are totally off. I think that the pairs command
changes all the factor columns into numeric columns - and by performing this
class transformation, the values within each column are also physically
changed.

I'm just really lost. Is there a way to utilize the pairs command in my
setting? Or is there a method to change the class of each column without
physically altering the values? Anyways, thanks in advance!!!
-- 
View this message in context: http://www.nabble.com/Question-regarding-dataframes%2C-matrix%2C-frame%2C-etc...-tp24056147p24056147.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list