vib321
vib321

Reputation: 71

Why subsetting of the data frame not working?

q <- p.adjust(tframe$p, "fdr")
CpGId <- dimnames(bmiqbeta.m)[[1]]
DF <- data.frame(CpGId, tframe$t, tframe$p, q)
dimnames(DF)[[2]] <- c("CpGId", "t", "p-value", "q")
DFred <- DF[DF$q < 0.05]

Initially I have tframe, a data frame with two columns namely t and p. Then as it is evident from code, I calculated p.adjust for tframe's p values. Then I created a new data frame "DF", but I wanted to change the names of columns of DF, so I changed them respectively. But now I want to do some subsetting of the DF but it's not working and shows the error Error in [.data.frame(DF, DF$q < 0.05) : undefined columns selected

Also if I try to view the values of column p-value by using command View(DF$p-value), it shows error as object values not found

Upvotes: 1

Views: 510

Answers (1)

Sotos
Sotos

Reputation: 51582

#for your first error
DFred <- DF[DF$q < 0.05, ] 
# for second error
View(DF$p-values) 

Upvotes: 2

Related Questions