genecount: Count the number of non-zero

Description Usage Arguments Examples

Description

Count the number of non-zero value for a vector

Usage

1
genecount(k, data, index)

Arguments

k

The kth row or column

data

A matrix

index

This must match one of "row" or "column" to extract the kth row or column vector

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
##---- Should be DIRECTLY executable !! ----
melanoma1=as.matrix(melanoma[,2:dim(melanoma)[2]])
row.names(melanoma1)=melanoma[,1]
genecount(k=6,data=melanoma1,index="row")

## The function is currently defined as
function (k, data, index) 
{
    if (index == "row") {
        x = data[k, ]
    }
    else {
        x = data[, k]
    }
    return(sum(x != 0))
  }

Fang0828/SCMarker documentation built on May 13, 2019, 12:51 p.m.