From 6a58f94d2339940dc45711d82e752a934a2cf163 Mon Sep 17 00:00:00 2001 From: Efrain Gonzalez Date: Mon, 19 Jun 2017 11:58:08 -0400 Subject: [PATCH] Dont use this code yet changed a few ifs to else ifs --- RAutoClDs.R | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/RAutoClDs.R b/RAutoClDs.R index 41ea2c1..e6866d7 100644 --- a/RAutoClDs.R +++ b/RAutoClDs.R @@ -28,29 +28,29 @@ chngrownm <- function(mat){ if("!Sample_source_name_ch1"==mat[1,e]){ colnames(mat)[e] <- "Brain_Region" } - if("!Sample_title" == mat[1,e]){ + else if("!Sample_title" == mat[1,e]){ colnames(mat)[e] <- "Title" } - if("!Sample_geo_accession" == mat[1,e]){ + else if("!Sample_geo_accession" == mat[1,e]){ colnames(mat)[e] <- "ID_REF" } else{ if(grepl("Sex|gender|Gender|sex",mat[2,e])==TRUE){ colnames(mat)[e] <- paste0("Sex",r) r = r + 1 } - if(grepl("postmorteminterval|PMI|pmi",mat[2,e])==TRUE){ + else if(grepl("postmorteminterval|PMI|pmi",mat[2,e])==TRUE){ colnames(mat)[e] <- paste0("PMI",a) a = a + 1 } - if(grepl("age|Age|AGE",mat[2,e])==TRUE){ + else if(grepl("age|Age|AGE",mat[2,e])==TRUE){ colnames(mat)[e] <- paste0("Age",h) h = h + 1 } - if(grepl("braak|b&b",mat[2,e])==TRUE){ + else if(grepl("braak|b&b",mat[2,e])==TRUE){ colnames(mat)[e] <- paste0("Braak",g) g = g + 1 } - if(grepl("group|disease|control|AD|normal|diagnosis|Alzheimer|Control|Normal",mat[2,e])==TRUE){ + else if(grepl("group|disease|control|AD|normal|diagnosis|Alzheimer|Control|Normal",mat[2,e])==TRUE){ colnames(mat)[e] <- paste0("Group",o) o = o + 1 } @@ -69,18 +69,18 @@ cinfo <- function(mat){ if(grepl("Group",colnames(mat)[j]) == TRUE){ mat[,j] <- gsub(".+:\\s|\\s.+;.+","",mat[,j]) } - if(grepl("Age",colnames(mat)[j])==TRUE){ + else if(grepl("Age",colnames(mat)[j])==TRUE){ mat[,j] <- gsub("\\D","",mat[,j])%>% as.integer() } - if(grepl("Sex",colnames(mat)[j])==TRUE){ + else if(grepl("Sex",colnames(mat)[j])==TRUE){ mat[,j] <- gsub(".+:\\s","",mat[,j]) } - if(grepl("PMI",colnames(mat)[j])==TRUE){ + else if(grepl("PMI",colnames(mat)[j])==TRUE){ mat[,j] <- gsub("[^0-9\\.]","",mat[,j])%>% as.numeric() } - if(grepl("Braak",colnames(mat)[j])==TRUE){ + else if(grepl("Braak",colnames(mat)[j])==TRUE){ mat[,j]<-gsub(".+:\\s","",mat[,j])%>% as.roman()%>% as.integer() -- 2.29.0