In the R definition:
When the if statement is not in a block the else, if present, must
appear on the same line as the end of statement2. Otherwise the new
line at the end of statement2 completes the if and yields a
syntactically complete statement that is evaluated. A simple solution
is to use a compound statement wrapped in braces, putting the else on
the same line as the closing brace that marks the end of the
statement.
(R Language Definition)
So, the 'else' must me in the same line as '}'. Either
a=2
if (length(a)>1){
b<<-rowSums(c[,-(1:2)][,c(T,F)]) } else {b<<-sum(c[seq(3,length(x),2)]) }
or
a=2
if (length(a)>1){
b<<-rowSums(c[,-(1:2)][,c(T,F)])
} else {b<<-sum(c[seq(3,length(x),2)]) }
but is still a bad code/identation pattern. I'd try something like
a=2
if (length(a)>1) {
b<<-rowSums(c[,-(1:2)][,c(T,F)])
} else {
b<<-sum(c[seq(3,length(x),2)])
}
to avoid further mistakes, or the suggested 'ifelse' function.