[R] how to be clever with princomp?

Simon Pickett S.Pickett at exeter.ac.uk
Fri Apr 27 13:58:12 CEST 2007


Hi all,

I have been using princomp() recently, its very useful indeed, but I have
a question about how to specify the rows of data you want it to choose.

I have a set of variables relating to bird characteristics and I have been
using princomp to produce PC scores from these.

However since I have multiple duplicate entries per individual (each bird
had a varying number of chicks), I only want princomp to treat each
individual bird as the sample and not include all the duplicates. Then I
want to replicate the pc scores for all the duplicated rows for that
individual.

Any idea how to do this?

Up to now I have been using princomp to only select the entries which are
not duplicated which is easy, but the difficult bit is the programming to
duplicate the pc scores across the entries for each individual.

(I developed something that worked but it takes about 5 minutes to run!)

Thanks for all your help,

very much appreciated,

Simon.




Simon Pickett
PhD student
Centre For Ecology and Conservation
Tremough Campus
University of Exeter in Cornwall
TR109EZ
Tel 01326371852



More information about the R-help mailing list