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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T04:00:22+00:00 2026-06-13T04:00:22+00:00

I have this data frame. I would like to create another data frame from

  • 0

I have this data frame. I would like to create another data frame from this which will include Trade_Date, Trades and Rejected. The rejected field needs to have the values from Closing_Date which will have to meet this criteria – Trade_Date + 1 day.

x

Trade_Date   Trades   Closing_Date   Rejected
9/16/2011   4126528     9/16/2011   15
9/19/2011   2565282     9/17/2011   33
9/20/2011   2953963     9/20/2011   30
9/21/2011   3255800     9/21/2011   6
9/22/2011   2862185     9/22/2011   21
9/23/2011   2405590     9/23/2011   30
9/26/2011   3196284     9/24/2011   30
9/27/2011   3761367     9/27/2011   15
9/28/2011   3198177     9/28/2011   9
9/29/2011   3255345     9/29/2011   6
9/30/2011   3810356     9/30/2011   12
10/3/2011   3817093     10/1/2011   21

for example, my next df will need to be like this:

Trade_Date      Trades    Rejected
9/16/2011       4126528   33
9/19/2011       2565282   30
9/20/2011       2953963   6

etc

Since there are many many rows, I need to do this programatically. Can any help?

  • 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-13T04:00:24+00:00Added an answer on June 13, 2026 at 4:00 am

    None of the rows in your example data frame meet the criteria you specify, so I will alter it slightly to demonstrate a simple way of doing this:

    #Read the data in
    dat <- read.table(text = "Trade_Date   Trades   Closing_Date   Rejected
     9/16/2011   4126528     9/16/2011   15
     9/19/2011   2565282     9/17/2011   33
     9/20/2011   2953963     9/20/2011   30
     9/21/2011   3255800     9/21/2011   6
     9/22/2011   2862185     9/22/2011   21
     9/23/2011   2405590     9/23/2011   30
     9/26/2011   3196284     9/24/2011   30
     9/27/2011   3761367     9/27/2011   15
     9/28/2011   3198177     9/28/2011   9
     9/29/2011   3255345     9/29/2011   6
     9/30/2011   3810356     9/30/2011   12
     10/3/2011   3817093     10/1/2011   21",sep = "",header = TRUE)
    
    #Convert to date
    dat$Trade_Date <- as.Date(dat$Trade_Date,"%m/%d/%Y")
    dat$Closing_Date <- as.Date(dat$Closing_Date,"%m/%d/%Y")
    
    #Alter some rows to meet your criteria
    dat$Closing_Date[1:3] <- dat$Trade_Date[1:3] + 1
    
    #Then we can simply subset the data
    > dat[dat$Closing_Date == dat$Trade_Date+1,]
      Trade_Date  Trades Closing_Date Rejected
    1 2011-09-16 4126528   2011-09-17       15
    2 2011-09-19 2565282   2011-09-20       33
    3 2011-09-20 2953963   2011-09-21       30
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have very wide data frame and would like to create many short data
I have a data frame with gaps like this: Var1 Var2 Var3 1 NA
I have a data.frame from this code: my_df = data.frame(read_time = c(2010-02-15, 2010-02-15, 2010-02-16,
I have a data.frame that looks like this: > head(ff.df) .id pio caremgmt prev
I have a data.frame in R that looks like this: score rms template aln_id
I have a data frame in R that looks like this: > TimeOffset, Source,
I have a dataframe with numeric entries like this one test <- data.frame(x =
Suppose I have a dataframe like this one: df <- data.frame (id = c(a,
I have a semi-melted data frame that looks like this: head(final_melt) Group Source variable
Let's say I have a data frame, like this: df <- data.frame( variable =

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.