[R] how to make row.names based on column1 with duplicated values

Stephen HonKit Wong stephen66 at gmail.com
Thu Mar 1 07:18:48 CET 2018


Dear All,
Suppose I have a dataframe like this with many thousands rows all with
different names:
data.frame(gene=c("a","b","c","d","c","d","c","f"),value=c(20,300,48,55,9,2,100,200)),

I want to set column "gene" as row.names, but there are duplicates (c, d),
which I want to transform into this as row names: a, b, c-1, d-1, c-2, d-2,
c-3, f

Many thanks!

Stephen

	[[alternative HTML version deleted]]



More information about the R-help mailing list