process_BAPS_data() can handle file being an R object
This commit is contained in:
parent
7b7968f00b
commit
73b0a70138
1 changed files with 11 additions and 2 deletions
|
|
@ -2,14 +2,23 @@ process_BAPS_data <- function(file, partitionCompare) {
|
||||||
if (!is.null(partitionCompare)) {
|
if (!is.null(partitionCompare)) {
|
||||||
cat('Data:', file, '\n')
|
cat('Data:', file, '\n')
|
||||||
}
|
}
|
||||||
data <- read.table(file)
|
|
||||||
ninds <- testaaOnkoKunnollinenBapsData(data) # for testing purposes?
|
# Importing data
|
||||||
|
if (is.character(file)) {
|
||||||
|
data <- read.table(file)
|
||||||
|
} else {
|
||||||
|
data <- file
|
||||||
|
}
|
||||||
|
|
||||||
|
ninds <- testaaOnkoKunnollinenBapsData(data) # Checks if last column is ID
|
||||||
if (ninds == 0) {
|
if (ninds == 0) {
|
||||||
warning('Incorrect Data-file.')
|
warning('Incorrect Data-file.')
|
||||||
return(NULL)
|
return(NULL)
|
||||||
}
|
}
|
||||||
|
|
||||||
popnames <- NULL # Dropped specification of population names (from BAPS 6)
|
popnames <- NULL # Dropped specification of population names (from BAPS 6)
|
||||||
|
|
||||||
|
# Processing data
|
||||||
result <- handleData(data, format = "BAPS")
|
result <- handleData(data, format = "BAPS")
|
||||||
data <- result$newData
|
data <- result$newData
|
||||||
rowsFromInd <- result$rowsFromInd
|
rowsFromInd <- result$rowsFromInd
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue