[R] using [i] to plot & label all vector elements

Damon Wischik djw1005 at cam.ac.uk
Wed Jul 2 18:36:44 CEST 2003


Robert Schick wrote:
> I've used brute force to label a series of vectors, and I'm wondering if
> there's a better way to do this. I wanted to create a biplot of the 2nd
> & 3rd PCs ...

I was unhappy with the standard biplot routine (the arrows didn't have
tick marks) so I wrote my own, a lattice version. It may be of some help,
but I should warn you that it is not wrapped up in a package, and there
are undoubtedly bugs. 
  http://www.statslab.cam.ac.uk/~djw1005/Stats/Interests/biplot.html

If m is a matrix with named rows and columns, you would invoke it by

res <- princompfull(m)

xyaplot (y~x, data=res$observations,
         axes=y~x, data.axes=res$variables, 
         subset.axes=c(FALSE,TRUE,TRUE,...), # whichever vectors to plot
         axes.spec=list(origin="o",min="min",max="max",ticks=TRUE),
         label="label", label.axes="label")

(The last two lines are a silly incantation which I will eventually tidy
up.)

Damon.




More information about the R-help mailing list