Q:

What's wrong with order function in data frame?

DF <- data.frame(CpGId, tframe$t, tframe$p, q)
dimnames(DF)[[2]] <- c("CpGId", "t_value", "p_value", "q_value")
DFhyper <- DF[with(DF, q_value < 0.05 & t_value> 0), ]
DFhyper <- data.frame(DFhyper, row.names = NULL)
DFhyper <- DFhyper [order(p_value), ]

Until fourth line of code, things work fine but then why R gives an error stating p_value object not found?

A:

R executes the bracketed expression first, without paying any attention to how it is going to be used.  When you type
DFhyper[order(p_value),]

R will look for p_value in the current scope (probably the global scope), however, as this is bound into the dataframe, it will not be able to find it.  You need to do something to tell it where this is located.
Either
DFhyper[order(DFhyper$p_value),]

or
DFhyper[with(DFhyper,order(p_value)),]

(or nearly equivalent, with(DFhyper,DFHyper[order(p_value),])) will work.  The first command tells R specifically that you are referencing the column in the data frame, and the second tells R to look in the dataframe for the variable if it can't find it in scope.
Finally, you can just bind the dataframe into the scope as well, executing
attach(DFhyper)
DFhyper[order(p_value),]

The attach command adds the dataframe columns to the current scope.  It can be useful for when you have many operations on the dataframe columns, but don't want to keep referencing it.  You can then detach it with detach(DFhyper) when you are done.

