[R] Subject [applying labels to a scatter plot matrix]
Marc Schwartz
MSchwartz at MedAnalytics.com
Sun Mar 27 05:05:07 CEST 2005
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
More information about the R-help
mailing list