ourMELONS/R/noIndex.R
2020-03-03 14:30:39 +01:00

19 lines
No EOL
638 B
R

#' @title No index
#' @description Checks that the data contains no index column.
#' @details As input, this function takes two variables from a mixture/admixture
#' result structure.
#' @return puredata: a data contains no index column.
#' @export
noIndex <- function (data, noalle) {
limit <- ifelse(is(noalle, "matrix"), ncol(noalle), length(noalle))
if (size(data, 2) == limit + 1) {
if (is(data, "matrix")) {
puredata <- data[, -ncol(data)] # remove the index column
} else {
puredata <- data[-length(data)]
}
} else {
puredata <- data
}
return(puredata)
}