Thank you all for the quick responses.
Setting 0 with *NA* is the right thing to do.
Also Peter, thanks to your package, using the command 'cos <-
cor(m,method='pearson',cosine=TRUE,use='p')' you mentioned' makes my life a
lot more easier.
zz
--
View this message in context:
http://r.789
On Thu, Aug 30, 2012 at 10:48 AM, zz wrote:
> Hello,
>
> I have a self-defined function to be computed on each column in a matrix.
> The basic idea is to ignore the elements that have value of 0 during
> computation.
>
> I should be able to write my own function but it could be computational
> exp
Hi zz,
The help file for the dist() function ( ?dist) says that
"Missing values are allowed, and are excluded from all computations
involving the rows within which they occur"
so if you can cajole this into any of the standard distance metrics,
you could do something like:
x[x == 0] <- NA
Hello,
I have a self-defined function to be computed on each column in a matrix.
The basic idea is to ignore the elements that have value of 0 during
computation.
I should be able to write my own function but it could be computational
expensive, so I'd love to ask if anyone may have suggestions
4 matches
Mail list logo