t.test error: data are essentially constant pval <- 0
for(i in 1:dim(rData1Q1)[1]){ 
    pval[i] <- t.test(rData1Q1[i,1:25],rData1Q1[i,26:34])$p.value  
}

I couldn't find the error source. When I run it for one row, it works. But in this loop it gives an error. What am I missing?
 A: It sounds like, with the nearly-constant data, R is getting a standard deviation $s\approx 0$, which is problematic when $s$ is in the denominator of the t-stat.
A: Some of the rows in your data are either constant - meaning the value is the same in every column, or near constant - meaning the difference between values is so small it cannot be distinguished from numerical precision fluctuations.
This is a common problem when running tests over genomic datasets - some genes will have 0 expression and so you will have 0s for every sample. You calculate tests for every gene in a row, the loop takes a long time and eventually terminates in the middle forcing you to find the offending gene, remove it, and rerun the procedure.
I often encounter similar scenarios in my work as well, so to help ease this inconvenience (and speed up tests) there is now a small R package - matrixTests. You can try it out like so:
library(matrixTests)
row_t_welch(rData1Q1[,1:25], rData1Q1[,26:34])

The computation will not terminate on error but will produce a warning and tell you the index of the offending row. The results (p-value, statistic, confidence interval, etc) will be returned in a convenient data.frame form, with values for the offending row turned to NA.
