I am trying to create a reference dataset from 40 different cell types (fpkm_matrix is a 26,000 x 40 log count matrix) and I am trting to find gene markers for each cell line.
My guess is that your cell.matrix contains no 'label' component since there's no 'label', only the expression, when you created it. In other words, cell.matrix$label is NULL. Maybe you have another variable (list) that contains the labels (component 'label') - you would want to use that instead of cell.matrix$label.
Thanks, Peter. I forgot to add the code line with the labels in my question (I did it in my original code). I added it to the question, but I still get the above error....
I am going to guess that each column name is unique, in which case there are no replicates for any of the labels; in this case, computing a p-value for differential comparisons is not possible. This is reflected in the error message, where it's telling you that there are no residual degrees of freedom for the t-test.
Check if the labels are something like CD4_rep1, CD4_rep2, etc. in which case you can just sub() out the _repX to get consistent labels for the same cell type. However, if you actually only have one column per cell type, you're stuffed. There's no way to compute p-values here. Perhaps use SingleR::getClassicMarkers() instead to get the top markers with the largest log-fold changes.
For either function, one would typically use the log-transformed values.
Thanks, Peter. I forgot to add the code line with the labels in my question (I did it in my original code). I added it to the question, but I still get the above error....