More concise way to sum elements of columns in R
Assuming your data are numeric and your columns are ordered by D-#, the following approaches should work:

Using apply:

errorarray$Q1 &lt;- apply(errorarray[, c(3, 6, 7, 14:16)], 1, sum) # using col indices
errorarray$Q1 &lt;- apply(errorarray[c("D-03", "D-06", "D-07", "D-15", "D-16")], 1, sum) # using column names


Using rowSums:

errorarray$Q1 &lt;- rowSums(errorarray[, c(3, 6, 7, 14:16)]) # using indices
errorarray$Q1 &lt;- rowSums(errorarray[c("D-03", "D-06", "D-07", "D-15", "D-16")]) # using column names


Note you can use ":" to denote the start and end of a number of consecutive columns.