Matrix multiplication, maybe?
> all_data %*% iu
a b c
[1,] 1 4 0
[2,] 2 5 0
[3,] 3 6 0
I have no idea if this is a general solution or not, but it works in
this case. If you need something else, perhaps a more realistic
example would help.
Dennis
On Wed, Nov 23, 2011 at 11:41 AM, Ben quant
Hi Ben,
Try
all_data[, colSums(iu) == 0] <- NA
all_data
HTH,
Jorge.-
On Wed, Nov 23, 2011 at 2:41 PM, Ben quant <> wrote:
> Hello,
>
> Is there a faster way to do this? Basically, I'd like to NA all values in
> all_data if there are no 1's in the same column of the other matrix, iu.
> Put ano
Hello,
Is there a faster way to do this? Basically, I'd like to NA all values in
all_data if there are no 1's in the same column of the other matrix, iu.
Put another way, I want to replace values in the all_data columns if values
in the same column in iu are all 0. This is pretty slow for me, but
3 matches
Mail list logo