Brett Stansfield
2005-Mar-27 02:36 UTC
[R] Subject [applying labels to a scatter plot matrix]
Dear R Is there a way to apply row names as labels to a scatter plot matrix , I tried pairs(dogs, labels=row.names) Error in strwidth(labels, "user") : cannot coerce type closure to character vector I'm not sure what this means, however maybe you might know of a way to do this? brett stansfield
Marc Schwartz
2005-Mar-27 03:05 UTC
[R] Subject [applying labels to a scatter plot matrix]
On Sun, 2005-03-27 at 14:36 +1200, Brett Stansfield wrote:> Dear R > Is there a way to apply row names as labels to a scatter plot matrix , > I tried > > pairs(dogs, labels=row.names) > Error in strwidth(labels, "user") : cannot coerce type closure to character > vector > > I'm not sure what this means, however maybe you might know of a way to do > this?Brett, 'row.names' is a function, that either gets or sets row names in a data frame. It requires an argument, which is a data frame, such as:> row.names(dogs)By itself you are attempting to set the labels to a function:> typeof(row.names)[1] "closure" Thus, the error message. Try:> pairs(dogs, labels=row.names(dogs))If 'dogs' is not a data frame, but is a matrix or array, try using:> pairs(dogs, labels=rownames(dogs))See ?row.names and ?rownames for more information. HTH, Marc Schwartz