#' @title Filter Out Caudal Brain Regions #' #' @description This function can be used when you're having alignment problems that affect only the caudal parts of the brain #' @param data a tibble containing individual fish as the columns and brain region names as the rows #' @param leaveOut I have gone through the anatomical map by hand and determined the brain regions that are caudal to the most #' commonly misaligned regions. If your alignment problems begin at rhombomere 7, inputting leaveOut = "rhomb7" will omit rhombomere 7, #' all regions contained within it, and all regions caudal to it, including the entire spinal cord. If your alignment problems begin at #' the spinal cord, inputting leaveOut = "spinalcord" will omit all spinal cord regions #' @export #' @examples filterCaudalBrain <- function(data, leaveOut) { if (leaveOut == "rhomb7") { regionsToInclude = read_xlsx("251_BrainRegions.xlsx") } else if (leaveOut == "spinalcord") { regionsToInclude = read_xlsx("275_BrainRegions.xlsx") } else { print("leaveOut must be either rhomb7 or spinalcord") } clean_names(regionsToInclude) clean_names(data) filteredData <- right_join(data, regionsToInclude, by = "ROIname,") return(filteredData) }