Ms Qiao,
On 10 April 2011 14:24, Wendy wrote:
> I have a huge matrix of TRUE/FALSE table like following, and I want to
> count
> the number of TRUEs in each row. Instead of looping through each row and do
> length(Z[Z==TRUE]), I am wondering if there is an easier way of doing this.
>
> [,1
Hi Wendy,
try this:
Z <- matrix(runif(1000)>0.5,10,100)
rowSums(Z)
HTH,
Denes
> Hi all,
>
> I have a huge matrix of TRUE/FALSE table like following, and I want to
> count
> the number of TRUEs in each row. Instead of looping through each row and
> do
> length(Z[Z==TRUE]), I am wondering if t
On Sun, Apr 10, 2011 at 2:24 PM, Wendy wrote:
> Hi all,
>
> I have a huge matrix of TRUE/FALSE table like following, and I want to count
> the number of TRUEs in each row. Instead of looping through each row and do
> length(Z[Z==TRUE]), I am wondering if there is an easier way of doing this.
>
>
Hi all,
I have a huge matrix of TRUE/FALSE table like following, and I want to count
the number of TRUEs in each row. Instead of looping through each row and do
length(Z[Z==TRUE]), I am wondering if there is an easier way of doing this.
[,1] [,2][,3]
[1,]TRUE FALSE FALSE
[2,]FALSE
4 matches
Mail list logo