Telma_7919
Telma_7919

Reputation: 209

How to perform the p.adjust in R?

I have a data frame with p.values and I want to adjust the p.values. I used this commad:

Padjust = p.adjust(pvalues, "fdr")

pvalues is my data frame with missing values and fdr is the method that I wish to use. However, I´m getting the following error:

Error in p.adjust(pvalues, "fdr") : 
 (list) object cannot be coerced to type 'double

Upvotes: 1

Views: 6318

Answers (1)

csgillespie
csgillespie

Reputation: 60462

The first argument of p.adjust should be a vector, see

?p.adjust

In your specific case, you need to select the values from your data frame and pass them to the function, so something like:

p.adjust(pvalues$p.values, "fdr")

if the column name was p.values. You could then add the adjusted p-values to your data frame via:

pvalues$adjust = p.adjust(pvalues$p.values, "fdr")

Upvotes: 3

Related Questions