On Jan 29, 2010, at 11:25 AM, Thiem Alrik 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))
I am guessing that you wanted to type:
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.
If so, then this should be step 1:
sum( pmin(data.set[,1], data.set[,101]))/sum(data.set[,101])
Do the same for column 2 and 102, 3 and 103 and so on.
Perhaps (runs without error but unverified):
sapply(1:100, function(x) sum(pmin(data.set[,x], data.set[,100+x]))/
sum(data.set[,100+x]))
Thanks a lot for your help.
Alrik
*******************************************
Alrik Thiem
Research Assistant
WEC E17
David Winsemius, MD
Heritage Laboratories
West Hartford, CT
______________________________________________
R-help@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.