R/stays_selection.R

Defines functions stays_by_diagnoses stays_by_act stays_by_years

stays_by_diagnoses <- function(data, diagnoses_vector ){
  stays <- data %>%
    select(id_stay, diagnoses) %>% 
    filter(diagnoses %like% regexpr_search(diagnoses_vector)) %>%
    select(id_stay) 
  
  return(stays)
}

stays_by_act <- function(data, procedures_vector){
  stays <- data %>%
    select(id_stay, procedures) %>% 
    filter(procedures %like% regexpr_search(procedures_vector)) %>%
    select(id_stay) 
  
  return(stays)
}

stays_by_years <- function(data, years_vector){
  
  stays <- data %>%
    select(id_stay, year) %>% 
    filter(year %in% years_vector) %>%
    select(id_stay) 
  
  return(stays)
}
jomuller/ITCARES documentation built on May 19, 2019, 7:26 p.m.