Skip to content

2017-7: Counting DNA Nucleotides

Write a function that takes a character vector representing a DNA string and returns 4 integers of the number of occurrences for each of the symbols 'A', 'C', 'G', and 'T' respectively.

Examples:

     (your_function) 'AGCTTTTCATTCTGACTGCTGTCTTTAAAAAAAGAGTGTCTGATAGCAG' 
14 8 10 17
     (your_function) 'CCAAATGGGG'
3 2 4 1
     (your_function) ''
0 0 0 0
     (your_function) ,'G'
0 0 1 0
your_function ←

Solutions

Video Thumbnail YouTube

Chat transcript Code on GitHub