I am relatively new to R, and I'm doing some dna sequence analysis. I wanted to know how to get the table function to return a zero if there are no N's in the sequence. Instead of returning zero it returns subscript out of bounds. I could do an if statement but I thought there might be a really simple way to fix this? Thanks for the help!
library(seqinr)
firstSet<-read.fasta("NC_000912.fna")
seqFirstSet<-firstSet[[1]]
length(seqFirstSet)
count(seqFirstSet,1)
count(seqFirstSet,2)
seqTable<-table(seqFirstSet)
seqTable[["g"]]
seqTable[["n"]]