0

Hello everyone I am new to R and i am trying to use the statistical power of R for my analysis. Below is an example of the data frame I have

Gene_Name Expression Cell Type
Gene_1         1    A
Gene_1         1.1  A
Gene_1         1.2  A
Gene_2         2.1  A
Gene_2         2.1  A
Gene_2         2.1  A
Gene_3         3.1  A
Gene_3         3.2  A
Gene_3          3   A
Gene_1          2   B
Gene_1         2.1  B
Gene_1         2.2  B
Gene_2         3.1  B
Gene_2         3.2  B
Gene_2         3.3  B
Gene_3          1   B
Gene_3         1.1  B
Gene_3         1.2  B

I have a data frame with expression data 10 genes in 100 different cell lines. Expression of each gene in each cell line has been checked 3 times that's why we want to perform the t.test on the repetitions

I want to run a t.test on Gene_X (X=1,2,3,4,5....) in cell type A, B, C.... I split the data using the following code

p <- split.data.frame(df, df$cell type) 

which created a list of data frame based on cell type. Then I used the lapply to further group data and create list of data frame which are grouped by gene_name

k<-lapply(p, function(x) {split.data.frame(x,x$Gene_Name)})

when i run the t.test on K as follows I get an error

ttest<-lapply(k, function(y){t.test(y,y[2])})

Error in var(x) : is.atomic(x) is not TRUE

Can anyone please explain me what I am doing wrong and how can i fix it

Thank you for helping me!!

Quang Hoang
  • 146,074
  • 10
  • 56
  • 74

1 Answers1

0

It's unclear to me what hypothesis you are trying to test. Can you please explain that in a bit more detail? It would also help to have reproducible code – what you posted clearly isn't what you are actually using because it contains syntax errors.

Phil
  • 185
  • 1
  • 9