Translated BAPS::noIndex into R
This commit is contained in:
parent
17282c423a
commit
8ecc59a4e6
4 changed files with 53 additions and 0 deletions
19
R/noIndex.R
Normal file
19
R/noIndex.R
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
#' @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)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue