R/ouinspph.R

Defines functions nspouiph

Documented in nspouiph

#' Oui/Non/Nsp
#'
#'Réorganise toutes les variables non/nsp/oui vers oui/non/nsp dans un data.frame
#'
#' @param tt data.frame
#'
#' @return data.frame
#' @export
nspouiph <- function(tt){
  ltt <- length(tt)
  for (i in 1:ltt){
    if(is.integer(tt[,i])==F & is.numeric(tt[,i])==F & length(levels(tt[,i]))==3){
      if (levels(tt[,i])[1]=="non" & levels(tt[,i])[2]=="nsp"){
        tt[,i] <- as.factor(tt[,i])
        tt[,i] <- factor(tt[,i],c("oui","non","nsp"))
        print("$")
      }
    }}
  print(levels(tt$iot))
  return(tt)
}
philippemichel/thesisph documentation built on Dec. 22, 2020, 11:08 a.m.