R/recode.R

"recode" <-
function(x,oldcode=sort(unique(x)),newcode){
  if(length(oldcode)!=length(newcode))stop("The number of old and new codes do not match")
  newx<-x
  for(i in 1:length(oldcode)){
    newx[x==oldcode[i]]<-newcode[i]
  }
  return(newx)
}

Try the blockmodelingOld package in your browser

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

blockmodelingOld documentation built on May 2, 2019, 5:11 p.m.