Displaying 1 result from an estimated 1 matches for "tp2295845p2295945".
Did you mean:
tp2295845p2295845
2010 Jul 20
2
Problem with command apply
I try to utilize some operations on rows in a matrix using command 'apply'
but find a problem.
First I write a simple function to normalize a vector (ignore error
handling) as follows:
normalize = function( v ) {
return( ( v-min(v) ) / ( max(v) - min(v) ) )
}
The function works fine for a vector:
> normalize( 1:5 )
[1] 0.00 0.25 0.50 0.75 1.00
Then I generate a matrix:
> a =