[R] How to allow duplicate names in R
Yogesh Gupta
n@b|yoge@h @end|ng |rom gm@||@com
Sun Jun 23 19:54:34 CEST 2019
I able to do it with the below code but in heat map it shows x at beginning
of each names.
x<-read.table("HEATMAP.ROOT.input.txt",sep="\t",head=T, check.names=TRUE)
x2 <- x[,-1]
rownames(x2) <- make.names(x[,1], unique = TRUE)
head(x2)
> head(x2)
Root_T1 Root_T2 Root_T3
X.GOUTA19 0.01179870 0.004254994 0.008371628
X.GOUTA19.1 0.01087136 0.025930026 0.012268479
X.Planctomyces 0.04665419 0.030925497 0.021187820
X.Methylomonas 0.01205195 0.019538770 0.035813232
X.Propionivibrio 0.10447746 0.286847806 0.184285575
X.Uliginosibacterium 0.16966278 0.193626963 0.232004759
How I can remove this X while plotting heat map:
for heat map I am using pheatmap:
pheatmap(x2,scale="row",color =cm.colors(100),cluster_cols =
F,show_colnames = T,cluster_row=F,border_color="NA")
Thanks
Yogesh
On Sun, Jun 23, 2019 at 6:32 PM Yogesh Gupta <nabiyogesh using gmail.com> wrote:
> Hi,
>
> I do have duplicates names in tab delimited files, I need to allow to read
> these duplicate names in R,
>
> Could you please suggest how can modify this code to allow to read
> duplicates names:
>
> x<-read.table("HEATMAP.ROOT.input.txt",sep="\t",head=T, check.names=FALSE)
>
> > x
>
> Genus Root_T1 Root_T2 Root_T3
>
> 1 GOUTA19 0.011798697 0.004254994 0.008371628
>
> 2 GOUTA19 0.010871359 0.025930026 0.012268479
>
> 3 Planctomyces 0.046654187 0.030925497 0.021187820
>
> 4 Methylomonas 0.012051952 0.019538770 0.035813232
>
> 5 Propionivibrio 0.104477461 0.286847806 0.184285575
>
>
>
> I need to make Genus name as row names but it shows error:
>
>
> x<-read.table("HEATMAP.ROOT.input.txt",sep="\t",head=T, check.names=FALSE,
> row.names=1)
>
> *Error in read.table("HEATMAP.ROOT.input.txt", sep = "\t", head = T,
> check.names = FALSE, : *
>
> * duplicate 'row.names' are not allowed*
>
>
> *Kind Regards*
>
> *Yogesh*
>
>
>
[[alternative HTML version deleted]]
More information about the R-help
mailing list