R/test_match_order.R

Defines functions test_match_order_by_rownames test_match_order

Documented in test_match_order

#' Title
#'
#' @param x vector to compare
#' @param y vector to compare
#'
#' @return true if the order matches otherwise is false

#'
test_match_order <- function(x, y) {


  if(is.null(x) | is.null(y))
    return(FALSE)

  if (all(x == y)) {
    return(TRUE)
  }
  # print('Perfect match in same order')

  if (!all(x == y) && all(sort(x) == sort(y))) {
    return(FALSE)
  }
  # print('Perfect match in wrong order')

  if (!all(x == y) && !all(sort(x) == sort(y))) {
    return(FALSE)
  }
  # print('No match')
}


test_match_order_by_rownames <- function(x, y) {


  if(is.null(x) | is.null(y))
    return(FALSE)

  if (all(rownames(x) == rownames(y))) {
    return(TRUE)
  }
  return(FALSE)
  # print('No match')
}
drake69/semseeker documentation built on Sept. 17, 2023, 12:22 a.m.