I have a dataframe with hundreds of p values I want to compute FDR significance for.
My dataframe:
Trait p-value1 p-value2 p-value3 pvalue4
1 0.5 0.01 0.1 0.12
2 0.1 0.9 0.4 0.32
3 0.2 0.45 0.34 0.45
4 0.2 0.02 0.22 0.11
I do it separately for each column with the following script (example on p-value1):
fdr <- p.adjust (p-value1, method = "fdr", n = length(p-value1))
How can I do it for all columns at the same time?
Assuming that you need not do it for PK i.e. trait
column. Try this in R version 4.1.0
lapply(my_df[-1], \(x) p.adjust (x, method = "fdr", n = length(x)))
OR this in older versions
lapply(my_df[-1], function(x) p.adjust (x, method = "fdr", n = length(x)))
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments