R/IPS_helper.R

## calculate Immunophenoscore
#' Title
#'
#' @param x
#'
#' @return
#' @export
#'
#' @examples
ipsmap<- function (x) {
  # if(is.na(x)) x<-0
  if (x<=0) {
    ips<-0
  } else {
    if (x>=3) {
      ips<-10
    } else {
      ips<-round(x*10/3, digits=0)
    }
  }
  return(ips)
}


#' Title
#'
#' @param x
#'
#' @return
#' @export
#'
#' @examples
mapcolors<-function (x) {
  za<-NULL
  if (x>=3) {
    za=1000
  } else {
    if (x<=-3) {
      za=1
    } else {
      za=round(166.5*x+500.5,digits=0)
    }
  }
  return(my_palette[za])
}

#' Title
#'
#' @param x
#'
#' @return
#' @export
#'
#' @examples
mapbw<-function (x) {
  za2<-NULL
  if (x>=2) {
    za2=1000
  } else {
    if (x<=-2) {
      za2=1
    } else {
      za2=round(249.75*x+500.5,digits=0)
    }
  }
  return(my_palette2[za2])
}
IOBR/IOBR documentation built on May 5, 2024, 2:34 p.m.