Remember that we had
gc_content <- function(dna, start, window) { freq <- table(dna[seq(from=start, length.out=window)]) ans <- (freq["g"]+freq["c"])/window return(ans) }
What if there is no "g"
? Then freq["g"]
is NA
and our function does not work