Commit 6a58f94d2339940dc45711d82e752a934a2cf163

Authored by Efrain Gonzalez
1 parent cae87f17c0
Exists in master

Dont use this code yet

changed a few ifs to else ifs
Showing 1 changed file with 10 additions and 10 deletions   Show diff stats
... ... @@ -28,29 +28,29 @@ chngrownm <- function(mat){
28 28 if("!Sample_source_name_ch1"==mat[1,e]){
29 29 colnames(mat)[e] <- "Brain_Region"
30 30 }
31   - if("!Sample_title" == mat[1,e]){
  31 + else if("!Sample_title" == mat[1,e]){
32 32 colnames(mat)[e] <- "Title"
33 33 }
34   - if("!Sample_geo_accession" == mat[1,e]){
  34 + else if("!Sample_geo_accession" == mat[1,e]){
35 35 colnames(mat)[e] <- "ID_REF"
36 36 } else{
37 37 if(grepl("Sex|gender|Gender|sex",mat[2,e])==TRUE){
38 38 colnames(mat)[e] <- paste0("Sex",r)
39 39 r = r + 1
40 40 }
41   - if(grepl("postmorteminterval|PMI|pmi",mat[2,e])==TRUE){
  41 + else if(grepl("postmorteminterval|PMI|pmi",mat[2,e])==TRUE){
42 42 colnames(mat)[e] <- paste0("PMI",a)
43 43 a = a + 1
44 44 }
45   - if(grepl("age|Age|AGE",mat[2,e])==TRUE){
  45 + else if(grepl("age|Age|AGE",mat[2,e])==TRUE){
46 46 colnames(mat)[e] <- paste0("Age",h)
47 47 h = h + 1
48 48 }
49   - if(grepl("braak|b&b",mat[2,e])==TRUE){
  49 + else if(grepl("braak|b&b",mat[2,e])==TRUE){
50 50 colnames(mat)[e] <- paste0("Braak",g)
51 51 g = g + 1
52 52 }
53   - if(grepl("group|disease|control|AD|normal|diagnosis|Alzheimer|Control|Normal",mat[2,e])==TRUE){
  53 + else if(grepl("group|disease|control|AD|normal|diagnosis|Alzheimer|Control|Normal",mat[2,e])==TRUE){
54 54 colnames(mat)[e] <- paste0("Group",o)
55 55 o = o + 1
56 56 }
... ... @@ -69,18 +69,18 @@ cinfo &lt;- function(mat){
69 69 if(grepl("Group",colnames(mat)[j]) == TRUE){
70 70 mat[,j] <- gsub(".+:\\s|\\s.+;.+","",mat[,j])
71 71 }
72   - if(grepl("Age",colnames(mat)[j])==TRUE){
  72 + else if(grepl("Age",colnames(mat)[j])==TRUE){
73 73 mat[,j] <- gsub("\\D","",mat[,j])%>%
74 74 as.integer()
75 75 }
76   - if(grepl("Sex",colnames(mat)[j])==TRUE){
  76 + else if(grepl("Sex",colnames(mat)[j])==TRUE){
77 77 mat[,j] <- gsub(".+:\\s","",mat[,j])
78 78 }
79   - if(grepl("PMI",colnames(mat)[j])==TRUE){
  79 + else if(grepl("PMI",colnames(mat)[j])==TRUE){
80 80 mat[,j] <- gsub("[^0-9\\.]","",mat[,j])%>%
81 81 as.numeric()
82 82 }
83   - if(grepl("Braak",colnames(mat)[j])==TRUE){
  83 + else if(grepl("Braak",colnames(mat)[j])==TRUE){
84 84 mat[,j]<-gsub(".+:\\s","",mat[,j])%>%
85 85 as.roman()%>%
86 86 as.integer()