R/limit_facets.R

Defines functions limit_facets

limit_facets <- function(dat,
                         facet_var,
                         facet_subset=NULL,
                         max_facets = NULL){
  if(!is.null(facet_subset)){
    dat <- dat[get(facet_var) %in% facet_subset,]
  }
  if(!is.null(max_facets)){
    ids <- utils::head(unique(dat[[facet_var]]),max_facets)
    dat <- dat[get(facet_var) %in% ids,]
  }
  return(dat)
}
neurogenomics/MultiEWCE documentation built on Sept. 28, 2024, 2:27 a.m.