[R] working with matrix

S Ellison S.Ellison at lgc.co.uk
Wed Jul 4 18:36:11 CEST 2007


Yemi,

Try

which.max(apply(X,1,prod))

(or possibly abs(apply(X,1,prod)) if you're only interested in unsigned product max.

S

>>> Yemi Oyeyemi <gmoyeyemi at yahoo.com> 04/07/2007 17:18:41 >>>
I am new in R and I want to solve this problem;
  I have a matrix X (with n-rows and p-colums) my problem is to obtain the products of the vectors of rows and print out only the maximum value and identify the row that gives the maximum value. Thanks
  Oyeyemi, G.M

 
---------------------------------
Don't pick lemons.

	[[alternative HTML version deleted]]

______________________________________________
R-help at 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 
and provide commented, minimal, self-contained, reproducible code.

*******************************************************************
This email and any attachments are confidential. Any use, co...{{dropped}}



More information about the R-help mailing list