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

  • Home
  • SEARCH
  • 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 649203
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T21:55:05+00:00 2026-05-13T21:55:05+00:00

I have a data.frame called series_to_plot.df which I created by combining a number of

  • 0

I have a data.frame called series_to_plot.df which I created by combining a number of other data.frames together (shown below). I now want to pull out just the .mm column from each of these, so I can plot them. So I want to pull out the 3rd column of each data.frame (e.g. p3c3.mm, p3c4.mm etc…), but I can’t see how to do this for all data.frames in the object without looping through the name. Is this possible?

I can pull out just one set: e.g. series_to_plot.df[[3]] and another by
series_to_plot.df[[10]] (so it is just a list of vectors..) and I can reference directly with series_to_plot.df$p3c3.mm, but is there a command to get a vector containing all mm’s from each data.frame? I was expecting an index something like this to work: series_to_plot.df[,3[3]] but it returns Error in [.data.frame(series_to_plot.df, , 3[3]) : undefined columns selected

series_to_plot.df
          p3c3.rd         p3c3.day    p3c3.mm      p3c3.sd                 p3c3.n p3c3.noo p3c3.no_NAs
    1     2010-01-04             0    0.1702531    0.04003364              7                1           0
    2     2010-01-06             2    0.1790594    0.04696674              7                1           0
    3     2010-01-09             5    0.1720404    0.03801756              8                0           0

          p3c4.rd         p3c4.day    p3c4.mm      p3c4.sd                 p3c4.n p3c4.noo p3c4.no_NAs
    1     2010-01-04             0    0.1076581   0.006542157              6                2           0
    2     2010-01-06             2    0.1393447   0.066758781              7                1           0
    3     2010-01-09             5    0.2056846   0.047722862              7                1           0

          p3c5.rd         p3c5.day    p3c5.mm      p3c5.sd                 p3c5.n p3c5.noo p3c5.no_NAs
    1     2010-01-04             0   0.07987147   0.006508766              7                1           0
    2     2010-01-06             2   0.11496167   0.046478767              8                0           0
    3     2010-01-09             5   0.40326471   0.210217097              7                1           0
  • 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-05-13T21:55:05+00:00Added an answer on May 13, 2026 at 9:55 pm

    To add to the other answers, I don’t think it is a good idea to have useful information encoded in variable names. Much better to rearrange your data so that all useful information is in the value of some variable. I don’t know enough about your data set to suggest the right format, but it might be something like

    p c         rd day date mm sd ...
    3 3 2010-10-04 ...
    

    Once you have done this the answer to your question becomes the simple df$mm.

    If you are getting the data in a less useful form from an external source, you can rearrange it in a more useful form like the above within R using the reshape function or functions from the reshape package.

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

Sidebar

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.