gravatar for Bioinfonext

2 hours ago by

Korea

I am using the below code to read a tab-delimited file which has spaces in the header name and these spaces converted into dots while plotting with corrplot.

Could anyone please help how I can avoid space to dot conversion?

library(vegan)
library(phyloseq)
library(ggplot2)
library(magrittr)
library(dplyr)
library(reshape2)
library(RColorBrewer)

library(readxl)
library(corrplot)
library("PerformanceAnalytics")
library("Hmisc")
library(psych)

list.files()
A <- read.table("Spearman.count.FINAL.txt",header=T, sep="t",check.names=F)
# Convert the first column to be row names
B <- A[, -1]
C <- data.frame(B, row.names=A$Sample)
M = as.matrix(C)
#View(M)
#--------------------Calculate correlation matrix and p-value matrix------------------------#
#-------------------------------------spearman---------------------------------------------#
cor_5 <- rcorr(as.matrix(M),type=c("spearman"))
r_mat <- cor_5$r
p_mat <- cor_5$P
# Extract the r and p (only Euka vs Bac, no inner correlations e.g. bac-bac)
r = r_mat[1:9,10:191]
p = p_mat[1:9,10:191]
# Only consider the positive correlation (r>0)
r_0 = r*(r> 0 )

Many thanks



Source link