R/fix_tester_names.R

Defines functions fix_tester_names

Documented in fix_tester_names

#' A function for fixing tester names
#'
#' This function will fix tester names
#'
#' @param dataToFix The input data
#' @param dataName The phenotype domain
#'
#' @return dataToFix The fixed data
#'
#' @examples
#' @export
#'

fix_tester_names <- function(dataToFix, dataName) {

  # OFA LD
  if (dataName == "OFA"| dataName == "LD" | dataName == "GTT" | dataName == "BodyComp") {
    dataToFix$Experimenter.ID[dataToFix$Experimenter.ID == "Zachery Seavey "] <- "Zachery Seavey"
    dataToFix$Experimenter.ID[dataToFix$Experimenter.ID == "ZS"] <- "Zachery Seavey"
    dataToFix$Experimenter.ID[dataToFix$Experimenter.ID == "REP"] <- "Rose Presby"
    dataToFix$Experimenter.ID[dataToFix$Experimenter.ID == "RP"] <- "Rose Presby"
    dataToFix$Experimenter.ID[dataToFix$Experimenter.ID == "Accuscan"] <- "Unknown"
    dataToFix$Experimenter.ID[dataToFix$Experimenter.ID == "OH"] <- "Olivia Hon"
    dataToFix$Experimenter.ID[dataToFix$Experimenter.ID == "JC"] <- "James Clark"
    dataToFix$Experimenter.ID[dataToFix$Experimenter.ID == "WR"] <- "Wilson Roper"
    dataToFix$Experimenter.ID[dataToFix$Experimenter.ID == "PF"] <- "Pamelia Fraungruber"
  }
  # HB PPI ABR GRIP HeartWeight ECT SLEEP
  if (dataName == "RR" | dataName == "HB"| dataName == "PPI" | dataName == "ABR" | dataName == "GRIP" | dataName == "HeartWeight" | dataName == "ECT" | dataName == "SHIRPA" | dataName == "SLEEP") {
    dataToFix$Experimenter[dataToFix$Experimenter == "ZS"] <- "Zachery Seavey"
    dataToFix$Experimenter[dataToFix$Experimenter == "GW"] <- "Gaylynn Wells"
    dataToFix$Experimenter[dataToFix$Experimenter == "SB"] <- "Samantha Burrill"
    dataToFix$Experimenter[dataToFix$Experimenter == "RP"] <- "Rose Presby"
    dataToFix$Experimenter[dataToFix$Experimenter == "KL"] <- "Kate Lachapelle"
    dataToFix$Experimenter[dataToFix$Experimenter == "CR"] <- "Christine Rosales"
    dataToFix$Experimenter[dataToFix$Experimenter == "Christine Rosales "] <- "Christine Rosales"
    dataToFix$Experimenter[dataToFix$Experimenter == "NC"] <- "Neil Cole"
    dataToFix$Experimenter[dataToFix$Experimenter == "NB"] <- "Nicholas Brown"
    dataToFix$Experimenter[dataToFix$Experimenter == "KL"] <- "Kate Lachapelle"
    dataToFix$Experimenter[dataToFix$Experimenter == "jr"] <- "Jennifer Ryan"
    dataToFix$Experimenter[dataToFix$Experimenter == "JR"] <- "Jennifer Ryan"
    dataToFix$Experimenter[dataToFix$Experimenter == "LH"] <- "Leslie Haynes"
    dataToFix$Experimenter[dataToFix$Experimenter == "LHl"] <- "Leslie Haynes"
    dataToFix$Experimenter[dataToFix$Experimenter == "OH"] <- "Olivia Hon"
    dataToFix$Experimenter[dataToFix$Experimenter == "SB/NC"] <- "Cole & Burrill"
    dataToFix$Experimenter[dataToFix$Experimenter == "TW"] <- "Troy Wilcox"
    dataToFix$Experimenter[dataToFix$Experimenter == "twilcox"] <- "Troy Wilcox"
    dataToFix$Experimenter[dataToFix$Experimenter == "lcanders"] <- "Laura Anderson"
    dataToFix$Experimenter[dataToFix$Experimenter == "LRB"] <- "Lindsay Bates"
    dataToFix$Experimenter[dataToFix$Experimenter == "Leslie Haynes &amp; Michaela Petit"] <- "Haynes & Petit"
    dataToFix$Experimenter[dataToFix$Experimenter == "Martha Abbott <[email protected]>"] <- "Nicholas Brown" #11/28/16 one test has Martha Abbot as tester, Nicholas tested the rest, so change name
    dataToFix$Experimenter[dataToFix$Experimenter == "MKP"] <- "Michaela Petit"
    dataToFix$Experimenter[dataToFix$Experimenter == "Neil Leslie Haynes"] <- "Leslie Haynes" # only one animal, the rest are Lelie Haynes, so changing the name to LH.
  }
  # TST
  if (dataName == "TST") {
    dataToFix$Experimenter[dataToFix$Experimenter == "ZS"] <- "Zachery Seavey"
    dataToFix$Experimenter[dataToFix$Experimenter == "TW"] <- "Troy Wilcox"
  }

  # Insulin
  if (dataName == "Insulin") {
    dataToFix$Blood.Collection.Experimenter[dataToFix$Blood.Collection.Experimenter == "OH"] <- "Olivia Hon"
    dataToFix$Blood.Collection.Experimenter[dataToFix$Blood.Collection.Experimenter == "SC"] <- "Steve Ciciotte"
    dataToFix$Blood.Collection.Experimenter[dataToFix$Blood.Collection.Experimenter == "PF"] <- "Pamelia Fraungruber"
    dataToFix$Blood.Analysis.Experimenter.ID[dataToFix$Blood.Analysis.Experimenter.ID == "SC"] <- "Steve Ciciotte"
  }
  # Urianalysis
  if (dataName == "Urianalysis" | dataName == "EKG" ) {
    dataToFix$Experimenter.ID.[dataToFix$Experimenter.ID. == "OH"] <- "Olivia Hon"
    dataToFix$Experimenter.ID.[dataToFix$Experimenter.ID. == "PF"] <- "Pamelia Fraungruber"
  }

  # ClinicalBloodChemistry
  if (dataName == "ClinicalBloodChemistry") {
    dataToFix$Analyst.ID[dataToFix$Analyst.ID == "SC"] <- "Steve Ciciotte"
    dataToFix$Experimenter.ID[dataToFix$Experimenter.ID == "OH"] <- "Olivia Hon"
  }

  return(dataToFix)
}
dleelab/KompUtils documentation built on May 13, 2017, 3:31 a.m.