From b9dba6f1f19933dd6c00d78e314cfa8ab7629044 Mon Sep 17 00:00:00 2001 From: Evert Van-Schaik <evert.van-schaik@inra.fr> Date: Tue, 3 Dec 2019 09:43:51 +0100 Subject: [PATCH] Upload New File --- loop_categorization_20191128.R | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 loop_categorization_20191128.R diff --git a/loop_categorization_20191128.R b/loop_categorization_20191128.R new file mode 100644 index 0000000..68ba018 --- /dev/null +++ b/loop_categorization_20191128.R @@ -0,0 +1,24 @@ + + +setwd("//pommard/agro-users$/evanschaik/Mes documents/Solca/Amplicon/16s") +b=read.csv("Solca_reference_1.3_DIRTY.csv", header = T,stringsAsFactors = F) + + +category <- function(b,n) +{ +n=0.2 +output <- b +for(j in 7:dim(b)[2]) + { + quant <- quantile(b[,j],na.rm=T,probs=seq(0,1,n)) + for (i in 1:length(quant)) + { + a <- which(b[j]>=quant[i]&b[j]<=quant[i+1]) + output[a,j] <- paste(colnames(output)[j],round(quant[i],2),round(quant[i+1],2),sep="_") + } + } +return(output) +} + +temp <- category(b,0.2) +write.table(temp,file="essai_b1ca_1.0.txt",quote=F,sep="\t",row.names = F) -- GitLab