Re: [R] Subject [applying labels to a scatter plot matrix]

From: Marc Schwartz <MSchwartz_at_MedAnalytics.com>
Date: Sun 27 Mar 2005 - 13:05:07 EST

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



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 Sun Mar 27 13:10:13 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:30:56 EST