Vector from Matrix
Try this also: pmin(data.set[,1:100], data.set[,101:200])/colSums(data.set[,101:200])
On Fri, Jan 29, 2010 at 2:25 PM, Thiem Alrik <thiem at sipo.gess.ethz.ch> wrote:
Dear Mailing List Members, the problem I've been grappling with f?r quite some time now is the following: I have a 100 rows x 200 columns matrix. data.set <- matrix(rnorm(20000, 100, 200)) Now I would like to get a vector of length 100 which collects the values from the following procedure: Take the sum of the minima of the two values from each row of columns 1 and 101, and divide it by the sum of column 101. Do the same for column 2 and 102, 3 and 103 and so on. Thanks a lot for your help. Alrik ******************************************* Alrik Thiem Research Assistant WEC E17 Weinbergstrasse 11 Center for Comparative and International Studies (CIS) and Center for Security Studies (CSS) Swiss Federal Institute of Technology Zurich CH-8092 Zurich Tel.: 0041 44 63 20937 thiem at sipo.gess.ethz.ch http://www.cis.ethz.ch/ http://www.css.ethz.ch/ ******************************************* ? ? ? ?[[alternative HTML version deleted]]
______________________________________________ R-help at r-project.org 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.
Henrique Dallazuanna Curitiba-Paran?-Brasil 25? 25' 40" S 49? 16' 22" O