Here is part of my data table, which I will call "df":
Subject.ID Sex V1 V2 V3 V4 V5
1 GTEX-1117F female 4.24944534 0.18307358 1.99276843 0.21785110 0.74777407
2 GTEX-1128S male 3.286585483 0.165944088 1.843983844 0.444455046 0.307311939
3 GTEX-11EMC female 3.31947343 0.27846061 1.46519089 0.33753984 0.91708799
4 GTEX-11GSP female 3.232353768 0.215492230 1.778208576 0.166458372 0.644225472
5 GTEX-11TTK male 2.934705200 0.256406854 1.712815854 0.256165277 0.948301812
6 GTEX-11ZUS male 3.77188558 0.18434378 2.43189035 0.37373172 1.14339342
7 GTEX-12WSD female 4.22032995 0.21933892 0.93900085 0.08687886 1.06901468
8 GTEX-12ZZX female 3.43616184 0.39473363 2.73205207 0.33525457 1.51399598
9 GTEX-1313W male 3.66334462 0.39418485 2.47248777 0.53545580 0.64634702
10 GTEX-131XW female 2.956614288 0.276317993 1.977096712 0.167743280 1.528071165
How do I correctly format the following code to account for the kind of dataframe I'm working with? I'm using sex as the factors to be interacted. Here is what I have so far:
design <- model.matrix(~ Sex)
fit <- lmFit(df, design)
fit <- eBayes(fit)
topTable(fit)
The first line is giving me the error "Error in eval(predvars, data, env) : object 'Sex' not found" (and idk why I'm getting this error since there is a "Sex" column in df). The second line gives me the error "Expression object should be numeric, instead it is a data.frame with n non-numeric columns" (and I know why I'm getting this error; I'm not sure how to handle the error, though).