You encountered a problem from this line of code:
femalet3$mean.f<-data.frame(mean.f=femalet3[,1], mean.f=rowMeans(femalet3[,-1]))
femalet3 is a data.frame to start with. If you try to assign another data frame to a column, it gives you something with a weird structure.
I simulate your dataset below to show where the error occurs:
femalet3 <- data.frame(Significance = letters[1:10],matrix(rnorm(80),ncol=8))
colnames(femalet3)[-1] = c("GSM1311840","GSM1311841","GSM1311842",
"GSM1311843","GSM1311844","GSM1311845","GSM1311846","GSM1311847")
femalet3$mean.f<-data.frame(mean.f=femalet3[,1], mean.f=rowMeans(femalet3[,-1]))
head(femalet3)
Significance GSM1311840 GSM1311841 GSM1311842 GSM1311843 GSM1311844
1 a -0.09282641 0.0753268 -0.04400652 0.02442526 0.3065423
2 b 1.14718259 0.6062297 -0.08556210 0.15121682 1.6412273
3 c -1.45645947 -1.6808505 -1.93452662 -0.06121562 1.9080640
4 d 0.03955011 1.5496713 -0.27779819 -0.69083631 0.8331726
5 e -0.61881124 1.2798835 -0.55046474 -0.61394703 2.3530607
6 f 1.77918616 0.5156059 0.37311045 1.77081855 -0.8689152
GSM1311845 GSM1311846 GSM1311847 mean.f.mean.f mean.f.mean.f.1
1 1.1210784 0.6891616 0.7314997 a 0.3514002
2 1.8341236 3.0722572 0.9026674 b 1.1586678
3 -0.5721591 2.8964295 -2.0082267 c -0.3636181
4 1.1212192 0.2129126 0.9595494 d 0.4684301
5 -0.6253303 1.0512457 -1.2166623 e 0.1323718
6 0.4963209 -0.5864916 0.4429023 f 0.4903172
This embeds a data.frame within the mean.f column in your data.frame:
ncol(femalet3)
10
head(femalet3$mean.f)
mean.f mean.f.1
1 a 0.3514002
2 b 1.1586678
3 c -0.3636181
4 d 0.4684301
5 e 0.1323718
We remove the previous weird column:
femalet3$mean.f <- NULL
To avoid this, what you simply need is:
femalet3$mean.f<-rowMeans(femalet3[,-1])
head(femalet3)
> head(femalet3)
Significance GSM1311840 GSM1311841 GSM1311842 GSM1311843 GSM1311844
1 a -0.09282641 0.0753268 -0.04400652 0.02442526 0.3065423
2 b 1.14718259 0.6062297 -0.08556210 0.15121682 1.6412273
3 c -1.45645947 -1.6808505 -1.93452662 -0.06121562 1.9080640
4 d 0.03955011 1.5496713 -0.27779819 -0.69083631 0.8331726
5 e -0.61881124 1.2798835 -0.55046474 -0.61394703 2.3530607
6 f 1.77918616 0.5156059 0.37311045 1.77081855 -0.8689152
GSM1311845 GSM1311846 GSM1311847 mean.f
1 1.1210784 0.6891616 0.7314997 0.3514002
2 1.8341236 3.0722572 0.9026674 1.1586678
3 -0.5721591 2.8964295 -2.0082267 -0.3636181
4 1.1212192 0.2129126 0.9595494 0.4684301
5 -0.6253303 1.0512457 -1.2166623 0.1323718
6 0.4963209 -0.5864916 0.4429023 0.4903172