Greetings,
I've been working at this for too long and making no headway. Perhaps
fresher
more experienced minds can help.
I have a matrix and I need to multiply every element in the matrix the
column number of the
matrix. Solutions seem to be avoiding me, help is greatly appreciated.
Is there an approach
that does not require the for loops?
Part of the function I've written to do this:
function(x) {
y <- table(x$imagery, x$histogram)
new <- matrix(1:nrow(y) * ncol(y), ncol = ncol(y))
for(j in 1:nrow(y))
for(i in 1:ncol(y))
new[i, j] <- y[i, j] * i
return(new)
# actually goes on to do some addtional computations here, rather than
just returning (new).
}
Assistance is greatly appreciated.
Thanks
Steve
-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu. To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message: unsubscribe s-news
|