R/02_algebrahelpers_quantiletransform.R

Defines functions quantiletransform

quantiletransform <- function(x){
  xNoNA <- x[!is.na(x)]
  ord <- order(xNoNA)
  sorted <- sort(xNoNA)
  nBelow <- rank(sorted, ties.method = "min")
  p <- nBelow / (max(nBelow)+1)
  q <- qnorm(p)
  xTrans <- x
  xTrans[!is.na(xTrans)][ord] <- q
  return(xTrans)
}

Try the psychonetrics package in your browser

Any scripts or data that you put into this service are public.

psychonetrics documentation built on Oct. 3, 2023, 5:09 p.m.