Modifying t-test for character values

Hello, I am trying to run a Welch two-sided t-test on the following sample data frame:

structure(list(CellType = structure(c(1L, 2L, 3L, 3L, 1L, 1L, 2L, 3L, 3L, 1L), .Label = c("CellA", "CellB", "CellC"), class = "factor"), Gene1 = structure(c(2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 2L), .Label = c("Mut", "Wt"), class = "factor")), class = "data.frame", row.names = c(NA,-10L))

I think the code might look something like this so I can run this t-test between specific Cell Types and Gene1 (having only binary values of Mutant vs Wild type):


However, this code doesn't work as is and might require conversion of text values (i.e. "Mut" and "Wt") into numeric values that can be recognized by t-test function. Any suggestions on how I can remedy this situation?

I think you need to consider the assumptions underlying the t-test and whether your data are appropriate for the test. It seems to me that your data represent categorization and that a chi-squared test is more appropriate.

Don't take my word for it, investigate the assumptions of the tests.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.