Re: [R] Finding Coordinate of Max/Min Value in a Data Frame

2008-06-11 Thread Gundala Viswanath
Thanks so much both. - Gundala On 6/11/08, Henrique Dallazuanna <[EMAIL PROTECTED]> wrote: > Try this: > > which(pca == min(pca), arr.ind = TRUE) > which(pca == max(pca), arr.ind = TRUE) > > > On Wed, Jun 11, 2008 at 7:34 AM, Gundala Viswanath <[EMAIL PROTECTED]> > wrote: > > > > Hi, > > > > Supp

Re: [R] Finding Coordinate of Max/Min Value in a Data Frame

2008-06-11 Thread DavidM.UK
Firstly surely (CL,PC5) = -0.7416656 is the minima? I think something like this should work, though I'm not sure library(MASS) data(crabs) crab.pca <- prcomp(crabs[,4:8],retx=TRUE) x<- crab.pca$rotation c.len = length(x[,1]) r.len = length(x[1,]) maxy = which(x == min(x)) x.co <- ceiling(max

Re: [R] Finding Coordinate of Max/Min Value in a Data Frame

2008-06-11 Thread Gabor Grothendieck
This suggests that one nice to have item would be to support arr.ind= on which.min and which.max On Wed, Jun 11, 2008 at 7:57 AM, Henrique Dallazuanna <[EMAIL PROTECTED]> wrote: > Try this: > > which(pca == min(pca), arr.ind = TRUE) > which(pca == max(pca), arr.ind = TRUE) > > On Wed, Jun 11, 2008

Re: [R] Finding Coordinate of Max/Min Value in a Data Frame

2008-06-11 Thread Henrique Dallazuanna
Try this: which(pca == min(pca), arr.ind = TRUE) which(pca == max(pca), arr.ind = TRUE) On Wed, Jun 11, 2008 at 7:34 AM, Gundala Viswanath <[EMAIL PROTECTED]> wrote: > Hi, > > Suppose I have the following data frame. > > __BEGIN__ > > > library(MASS) > > data(crabs) > > crab.pca <- prcomp(crabs[

[R] Finding Coordinate of Max/Min Value in a Data Frame

2008-06-11 Thread Gundala Viswanath
Hi, Suppose I have the following data frame. __BEGIN__ > library(MASS) > data(crabs) > crab.pca <- prcomp(crabs[,4:8],retx=TRUE) > crab.pca$rotation PC1PC2PC3PC4PC5 FL 0.2889810 0.3232500 -0.5071698 0.7342907 0.1248816 RW 0.1972824 0.8647159 0.414135