R/rinv.R

Defines functions rinv

Documented in rinv

rinv <- function(dset){
nitem <- ncol(dset)-1
temp <- matrix(data = 0, nrow = nrow(dset), ncol = nitem, byrow = TRUE)
rorder <- matrix(data = 0, nrow = nrow(dset), ncol = nitem, byrow = TRUE)
rorder <- dset[,1:nitem]

## compute the ordering of the observations
for (i in 1:(nrow(rorder))){
for (j in 1:nitem){
for (k in 1:nitem){
if (rorder[i,j] == k){
temp[i,k] <- j
}
}
}
}

return(data.frame(temp,n=dset[,(nitem+1)]))
}

Try the pmr package in your browser

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

pmr documentation built on June 24, 2022, 5:06 p.m.