r - How to use unique function with blank/missing values -
how possible make below data frame rows uniquely depend on second column when there blank/missing values?
> head(interproscan) v1 v14 1 sp0000001-mrna-1 2 sp0000001-mrna-1 3 sp0000001-mrna-1 4 sp0000005-mrna-1 go:0003723 5 sp0000006-mrna-1 go:0016021 6 sp0000006-mrna-1 go:0016021 > head(unique(interproscan[ , 1:2] )) v1 v14 1 sp0000001-mrna-1 4 sp0000005-mrna-1 go:0003723 5 sp0000006-mrna-1 go:0016021 7 sp0000006-mrna-2 go:0016021 9 sp0000006-mrna-3 go:0016021
the aim be:
v1 v14 1 sp0000001-mrna-1 4 sp0000005-mrna-1 go:0003723 5 sp0000006-mrna-1 go:0016021
thank in advance
try data frame or data table:
interproscan <- data.frame(interproscan) unique(interproscan)
output:
v1 v14 1 sp0000001-mrna-1 4 sp0000005-mrna-1 go:0003723 5 sp0000006-mrna-1 go:0016021
sample data:
require(data.table) interproscan <- fread("v1, v14 sp0000001-mrna-1, sp0000001-mrna-1, sp0000001-mrna-1, sp0000005-mrna-1, go:0003723 sp0000006-mrna-1, go:0016021 sp0000006-mrna-1, go:0016021")
Comments
Post a Comment