R/binary_convert.R

Defines functions binary_convert

Documented in binary_convert

binary_convert <-
function(matrix,threshold){
    binary<-matrix(,nrow(matrix),ncol(matrix)) #This creates an empty matrix (Precisely, matrix with all NAs)
    rownames(binary)<-rownames(matrix)
    colnames(binary)<-colnames(matrix)
    binary[matrix>=threshold]=1
    binary[matrix<threshold]=0
    return(as.data.frame(binary)) 
}
peterwu19881230/microbialPhenotypes documentation built on March 19, 2021, 6:36 a.m.