I have a dataframe (mydataframe1) which looks like this :
gene expression description
... ... ... ...
112 G1246 2.4567 Heat shock protein
113 G1389 -1.7491 Heat regulation
114 G1467 0.1234 Cell component
... ... ... ...
753 G1923 0.9435 Heat adaptative synthesis
... ... ... ...
2843 G2123 1.4677 Immune response
I'm interested in genes having "heat" in their description, to get the concerned lines, I used the following script :
mydataframe2 <- mydataframe1[grep("heat_?", mydataframe1$description, ignore.case = TRUE),]
I get a dataframe (mydataframe2) with the corresponding rows, but the row numbering is the same as in the original dataframe
gene expression description
112 G1246 2.4567 Heat shock protein
113 G1389 -1.7491 Heat regulation
753 G1923 0.9435 Heat adaptative synthesis
I save this like this :
write.table(mydataframe2, "/my/path/heat_gene.csv", row.names=FALSE , col.names=TRUE, sep="\t", dec=".", quote=FALSE)
But when I open heat_gene.csv, I see that there are still all the rows of mydataframe1.
Do you know why?