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 6677535
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:08:00+00:00 2026-05-26T04:08:00+00:00

I have a data.frame named pp that looks like this: > head(pp) X02R X03N

  • 0

I have a data.frame named pp that looks like this:

> head(pp)    
            X02R  X03N  X04K  X04N  X04R  X06I  X06N  X08J  X08P  X09O  X11O   
1961-02-28  42.0  43.0  96.2  10.2  13.5  42.4  21.1  79.1   2.7  15.2  14.3  
1962-02-28  17.1  22.7  27.9 140.7  10.0  36.7   8.2  47.2  28.5  31.5  24.0

Separately I am calculating

dmax<-douro[which(douro[,3]== max(douro[,3])),] 

which, for example gives me:

 > dmax   
   name catch corre.gauge  
31 X04K Douro  -0.5157648

Now I want to use the result dmax[1] (the name) to plot the respective column of data from pp. In this case I would like to plot pp$X04K. How can I do that in an automatic way (because I am going to repeat this process several times resulting in different columns from pp)?

  • 1 1 Answer
  • 1 View
  • 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-05-26T04:08:01+00:00Added an answer on May 26, 2026 at 4:08 am

    Joran just edited your post which means I will be asked to reload the page because an answer has been provided… Getting to the heart of the matter, you can extract the column name and pass it on to [ like so:

    pp[, as.character(dmax[1,1])]
    

    The comma is not mandatory but play around with it to see how the layout of the result changes.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a large data frame (named z ) that looks like this: RPos
I have a semi-melted data frame that looks like this: head(final_melt) Group Source variable
I have a data.frame in R that looks like this: score rms template aln_id
Assuming I have a melted data.frame that looks like this: variable value 1 A
I have the following data frame (info) that looks like this: > info[1:5,] field
I have a data frame with gaps like this: Var1 Var2 Var3 1 NA
I have a data frame that looks as follows (8 columns - the myPOSIX
I have a editable FormPanel that looks like this: I now want to display
Possible Duplicate: Extracting indices for data frame rows that have MAX value for named
I have a data.frame from this code: my_df = data.frame(read_time = c(2010-02-15, 2010-02-15, 2010-02-16,

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.