>x
[,1] [,2]
[1,]12
[2,]13
[3,]24
[4,]11
>length(which((x[,1]==1)))
[1] 3
>length(which((x[,2]==1)))
[1] 1
#x[,1]==1判断是否为1,返回True或False
# which((x[,1]==1))返回为True的行号
#length(which((x[,1]==1)))返回为True的行数,即1的个数
>x
[,1] [,2]
[1,]12
[2,]13
[3,]24
[4,]11
>length(which((x[,1]==1)))
[1] 3
>length(which((x[,2]==1)))
[1] 1
#x[,1]==1判断是否为1,返回True或False
# which((x[,1]==1))返回为True的行号
#length(which((x[,1]==1)))返回为True的行数,即1的个数