R/pullReported.R

Defines functions reportedFun otherRepFun

Documented in reportedFun reportedFun

### Pull reported files


reportedFun <- function(dat,yr,rep_code){
  f <- dat
  f$INCCAN <- f[[paste0("INCCAN",yr)]]
  f$report <- 0
  f$report[f$INCCAN %in% rep_code] <- 1
  f <- f[,c("ID","report")]
  f <- f[f$report==1,]
  names(f) <- c("ID",paste0("report",yr))
  f <- f[!duplicated(f$ID),]
  return(f)
}
otherRepFun <- function(dat,yr,rep_code){
  f <- dat
  f$INCCAN <- f[[paste0("INCCAN",yr)]]
  f$othrep <- 0
  f$othrep[!f$INCCAN %in% rep_code] <- 1
  f <- f[f$othrep==1,c("ID","othrep")]
  names(f) <- c("ID",paste0("othrep",yr))
  return(f)
}
buddha2490/MargotFun documentation built on Nov. 4, 2019, 8:16 a.m.