Sum of the number of occurrences R array

I'm not sure I understand what you're asking.

I'm guessing that you meant that you have the strings in a comma separated text file. Is that it?

If so, then it can be done easily. First, suppose there's a text file named segment.txt in the working directory. It's contents are in this form:

"Segments"
"TATLQAKA"
"QCLKMLET"
"EARKIFRF"
"SKKELKEL"
"CPVGFLGN"
"VNTQPGFH"
"GDGRGDIC"
"IPSNFVSP"
"EFFRGLNI"
"SCTYQLAR"

Then, read that file in R using read.csv and use the rest of the code.

By the way, I found that strsplit can be used in this instead of stringr::str_split_fixed. Hence, being biased, let me post that solution too (essentially they are same).

library(package = "dplyr")

dataset <- read.csv(file = "segment.txt",
                    stringsAsFactors = FALSE)

do.call(what = rbind,
        args = strsplit(x = dataset$Segments,
                        split = "")) %>%
  as.data.frame() %>%
  mutate_all(.funs = ~ table(.)[.]) %>%
  mutate(strings = dataset$Segments,
         scores = rowSums(.[-9]))

Now, if your question is answered, will you please consider marking this thread as solved?

If you don't know how to do it, please take a look at this thread: