[R] How to allow duplicate names in R

Jeff Newmiller jdnewm|| @end|ng |rom dcn@d@v|@@c@@u@
Sun Jun 23 22:46:20 CEST 2019


I don't know anything about gene sequencing analysis. You may find better expertise for that on the Bioconductor mailing list.

On June 23, 2019 12:28:59 PM PDT, Yogesh Gupta <nabiyogesh using gmail.com> wrote:
>Thanks Jeff
>
>Actually these are Amplicon sequencing variant which are differ at
>single
>nucleotide but may belongs to same genus, or further may be same
>species,
>but may be different bacterial strain, so I will think about it what
>should
>I do, may be I can plot with OTU ID and genus together...or can just
>aggregate at genus level...could you please suggest how I can aggregate
>same genus name ID while importing data into R.
>
>Thanks
>Yogesh
>
>On Sun, 23 Jun 2019, 20:09 Jeff Newmiller, <jdnewmil using dcn.davis.ca.us>
>wrote:
>
>> Some concepts are so fundamental that they get encoded into
>> general-purpose code. The idea that each row (column) of a heat map
>should
>> be uniquely identifiable among all other rows (columns) is one such
>idea.
>>
>> To break this rule you will have to create your own heatmap function.
>I
>> strongly recommend that you not do this. Rather, you should study why
>there
>> are duplicates in your data, and consider options such as removing
>> duplicates, re-labelling duplicates, or aggregating the values
>> corresponding to duplicates (e.g. mean, median, max...) before
>plotting so
>> that the result will be meaningful to the viewer.
>>
>> On June 23, 2019 10:54:34 AM PDT, Yogesh Gupta <nabiyogesh using gmail.com>
>> wrote:
>> >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]]
>> >
>> >______________________________________________
>> >R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> >https://stat.ethz.ch/mailman/listinfo/r-help
>> >PLEASE do read the posting guide
>> >http://www.R-project.org/posting-guide.html
>> >and provide commented, minimal, self-contained, reproducible code.
>>
>> --
>> Sent from my phone. Please excuse my brevity.
>>

-- 
Sent from my phone. Please excuse my brevity.



More information about the R-help mailing list