Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8933305
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T09:30:20+00:00 2026-06-15T09:30:20+00:00

I have a data.frame with an id field and three different and unrelated p-values.

  • 0

I have a data.frame with an id field and three different and unrelated p-values. I would like to apply the benjamini-hochberg corection at each column.
I’ve been working with the p.adjust as function p.adjust(data[,2], "BH"), but I’m having trouble since I have to sort each column before applying the correction and I lose the id information after that. My data looks like:

id  p1  p2  p3
1   ENSG00000179094 1.000000e+00    1.000000e+00    1.000000e+00
2   ENSG00000164306 1.000000e+00    1.000000e+00    1.000000e+00
3   ENSG00000147180 1.000000e+00    8.778847e-02    1.000000e+00
4   ENSG00000172932 4.370119e-01    1.766703e-04    1.000000e+00
5   ENSG00000137252 1.000000e+00    2.562124e-02    1.000000e+00
6   ENSG00000144644 1.654108e-02    1.000000e+00    1.000000e+00
7   ENSG00000197273 3.316301e-01    5.341301e-01    1.000000e+00
8   ENSG00000169221 1.000000e+00    1.000000e+00    1.000000e+00
9   ENSG00000108309 8.689368e-01    2.350522e-03    1.000000e+00
10  ENSG00000172382 1.000000e+00    9.028471e-01    2.697276e-02
11  ENSG00000099937 1.000000e+00    1.000000e+00    9.988716e-01
12  ENSG00000259431 1.000000e+00    1.000000e+00    7.268023e-01
...

Is there an easiest way or package to do this without losing the information from the id’s?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T09:30:21+00:00Added an answer on June 15, 2026 at 9:30 am

    You can use numcolwise , apply a function to only numeric columns of a data.frame.

    library(plyr) 
     cbind(dat$id,numcolwise(p.adjust)(dat))
                 dat$id       p1          p2        p3
    1  ENSG00000179094 1.000000 1.000000000 1.0000000
    2  ENSG00000164306 1.000000 1.000000000 1.0000000
    3  ENSG00000147180 1.000000 0.790096230 1.0000000
    4  ENSG00000172932 1.000000 0.002120044 1.0000000
    5  ENSG00000137252 1.000000 0.256212400 1.0000000
    6  ENSG00000144644 0.198493 1.000000000 1.0000000
    7  ENSG00000197273 1.000000 1.000000000 1.0000000
    8  ENSG00000169221 1.000000 1.000000000 1.0000000
    9  ENSG00000108309 1.000000 0.025855742 1.0000000
    10 ENSG00000172382 1.000000 1.000000000 0.3236731
    11 ENSG00000099937 1.000000 1.000000000 1.0000000
    12 ENSG00000259431 1.000000 1.000000000 1.0000000
    

    To use other arguments:

    cbind(dat$id,numcolwise(p.adjust)(dat, method = 'bonferroni', n = 20))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a data frame like below (20,000 rows by 49 cols). Each row
I have a data.frame of a time series of data, I would like to
I have this data frame. I would like to create another data frame from
I have the following data frame (info) that looks like this: > info[1:5,] field
I have a file, called genes.txt , which I'd like to become a data.frame.
I have data frame with some numerical variables and some categorical factor variables. The
I have a data frame with start dates and end dates, along with the
I have a data frame with two qualitative variables (Q1, Q2) which are both
I have a data frame that is some 35,000 rows, by 7 columns. it
I have a data frame consisting of results from multiple runs of an experiment,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.