-
Notifications
You must be signed in to change notification settings - Fork 0
/
testdata.R
executable file
·66 lines (52 loc) · 2.16 KB
/
testdata.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
source("C:\\Users\\Konstantin\\Desktop\\Uni\\6Semester\\BachelorArbeit\\code\\ReadingData.R")
testdata <- function(){
data <- readFile("C:\\Users\\Konstantin\\Desktop\\Uni\\6Semester\\BachelorArbeit\\BeispielDaten\\metabExampleMaleFemaleSMALLSET50.xlsx")
#data <- readFile("C:\\Users\\Konstantin\\Desktop\\Uni\\6.Semester\\BachelorArbeit\\data\\QMDiab_aminoGlucose.xlsx")
inputData <- data$values[complete.cases(data$values), ]
tempId <- 1
tempStart <- 4
tempEnd <- 18
id <- inputData[[tempId]]
metab <- inputData[c(tempStart:tempEnd)]
pheno <- inputData[-c(tempId,c(tempStart:tempEnd))]
pheno$None <- numeric(length(id[[1]]))
metabComplete <- data.frame(scale(metab))
metabComplete
}
getData <- function(small=TRUE){
if (small){
data <- readFile("C:\\Users\\Konstantin\\Desktop\\Uni\\6Semester\\BachelorArbeit\\BeispielDaten\\paramTuningSmall.xlsx")
#data <- readFile("C:\\Users\\Konstantin\\Desktop\\Uni\\6.Semester\\BachelorArbeit\\data\\paramTuningSmall.xlsx")
tempId <- 1
tempStart <- 2
tempEnd <- 37
} else {
data <- readFile("C:\\Users\\Konstantin\\Desktop\\Uni\\6Semester\\BachelorArbeit\\BeispielDaten\\Metabolomics.data.f4.published2011.xlsx")
#data <- readFile("C:\\Users\\Konstantin\\Desktop\\Uni\\6.Semester\\BachelorArbeit\\data\\Metabolomics.data.f4.published2011.xlsx")
tempId <- 1
tempStart <- 5
tempEnd <- 155
}
inputData <- data$values[complete.cases(data$values), ]
id <- inputData[[tempId]]
metab <- inputData[c(tempStart:tempEnd)]
pheno <- inputData[-c(tempId,c(tempStart:tempEnd))]
pheno$None <- numeric(length(id[[1]]))
metabComplete <- data.frame(scale(metab))
res <- list(metabComplete,pheno)
res
}
testDataFrame <- function(){
result <- data.frame(one=rep(NA,10),two=rep(NA,10),three=rep(NA,10),four=rep(NA,10),five=rep(NA,10))
result[1,] <- list(1,1,1,1,1)
result[2,] <- list(0,0,0,0,0)
result[3,] <- list(0,0,0,0,0)
result[4,] <- list(1,1,1,1,1)
result[5,] <- list(1,1,1,1,1)
result[6,] <- list(1,1,1,1,1)
result[7,] <- list(1,1,1,1,1)
result[8,] <- list(0,0,0,0,0)
result[9,] <- list(1,1,1,1,1)
result[10,] <- list(0,0,0,0,0)
result
}