R/Dk.r

Defines functions Dk

Dk<-function(x){
  x<-as.factor(x)
  lv<-levels(x)
  dk<-matrix(NA,ncol=length(lv),nrow=length(x))
  colnames(dk)<-lv
  for(i in 1:length(lv)){
    dk[,i]<-ifelse(x==lv[i],1,0)
  }
  return(dk)
}

Try the ProbSamplingI package in your browser

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

ProbSamplingI documentation built on May 29, 2024, 6:15 a.m.