This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to get this done in R? Combine rows with the same position.

Hi Guys,

I have a huge table like the one shown below with repeated snp positions. I want to combine all the rows with same position and get the nucleotide counts for each position as shown in the result. Thank you for your help!

df1

     seqnames      pos nucleotide count
  1:    chr11  1643082          A  1
  2:    chr11  1643082          C  3
  3:    chr11  1643082          T 18
  4:    chr11 47663948          C 27
  5:    chr11 47663948          T  2

result

chr11:1643082   T:18,C:3,A:1
chr11 47663948  C:27,T:2
r

Sorry, Thanks!

0 answers

No answers yet.

Log in to answer this question.