R/findParentDirectory.R

Defines functions findParentDirectory

Documented in findParentDirectory

#' Find the path to Parent Directory
#'
#' Equivalent of \code{mh_findParentDirectory}. Is useful for running a project
#'   across multiple computers where the project is stored in different directories.
#'
#' @param Parent the name of the directory to which the function should track back.
#' Should be the root of the GitHub repository
#'
#' @author Mikey Harper, \email{m.harper@@soton.ac.uk}
#' @export
#'
findParentDirectory <- function(Parent){
  directory <-getwd()
  while(basename(directory) != Parent){
    directory <- dirname(directory)

  }
  return(directory)
}
dr-harper/HarpR documentation built on Nov. 8, 2019, 8:56 p.m.