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 blockmodelingVer036 package in your browser

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

blockmodelingVer036 documentation built on July 1, 2020, 3:02 p.m.