[R] Multiplying two vectors of the same size to give a third vector of the same size

Philip Rhoades ph|| @end|ng |rom pr|com@com@@u
Tue Jun 20 17:38:17 CEST 2023


People,

I am assuming that what I want to do is easier in R than say Ruby.

I want to do what the Subject says ie multiply the cells in the same 
position of two vectors (A and B) to give a result in the same position 
in a third vector (C) BUT:

- The values in the cells of A and B are floats between 0.0 and 1.0 or 
NULL

- If there is a NULL in the multiplication, then the result in the cell 
for C is also a NULL

- If there is a value less than (say) 0.01 in the multiplication, then 
the result in the cell for C is 0.0

Any suggestions appreciated!

Phil.

-- 
Philip Rhoades

PO Box 896
Cowra  NSW  2794
Australia
E-mail:  phil using pricom.com.au



More information about the R-help mailing list