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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T22:22:01+00:00 2026-06-05T22:22:01+00:00

I have following data frames > head(elo) date elo 1 1921-12-18 1597 2 1922-05-14

  • 0

I have following data frames

> head(elo)
        date    elo
1 1921-12-18   1597
2 1922-05-14   1583
3 1922-05-28   1595
4 1922-09-03   1595
5 1922-10-01   1612
6 1923-06-03   1597
[...]
> head(coaches)
      surname       start        stop
        Smith  1921-12-18  1922-05-28
        White  1922-06-01  1923-06-28
        Black  1923-09-13  1928-01-01

Output should looks like:

        date    elo  coach
1 1921-12-18   1597  Smith   
2 1922-05-14   1583  Smith  
3 1922-05-28   1595  Smith  
4 1922-09-03   1595  White  
5 1922-10-01   1612  White  
6 1923-06-03   1597  White      
[...]    

How can I assign coaches$surname to elo rows based on start and stop columns? Intervals in coaches dataframe are not overlapping.

  • 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-05T22:22:03+00:00Added an answer on June 5, 2026 at 10:22 pm
    lst <- lapply(1:nrow(coaches),function(x) 
                 elo[which(elo$date >= coaches$start[x] & elo$date <= coaches$stop[x]),])
    cbind(as.data.frame(do.call(rbind, lst)),
          coach = rep(coaches$surname, sapply(lst, function(x) nrow(x))))
            date  elo coach
    1 1921-12-18 1597 Smith
    2 1922-05-14 1583 Smith
    3 1922-05-28 1595 Smith
    4 1922-09-03 1595 White
    5 1922-10-01 1612 White
    6 1923-06-03 1597 White
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following data.frames: a <- data.frame(id = 1:3, v1 = c('a', NA,
I have the following data frame: Date,Year,Austria,Germany,... 1969-12-31,1969,96.743,95.768,... 1970-01-30,1970,95.515,95.091,... 1970-02-27,1970,95.075,95.235,... Ultimately, I would like
I have the following code using data.frames, and I'm wondering how to write this
have the following data frames: id1<-c(1,2,3,4,5) spent<-c(10,20,30,40,50) id2<-c(1,3,4) x<-c(1,2,2) df1<-data.frame(id1,spent) df2<-data.frame(id2,x) I need to
I have two data frames that look like something like the following: df1 <-
I have the following two data frames: d <- data.frame(c1 = c(A,A,B,C,A,C,D,D)) map <-
Suppose I have the following data frame: Data1 X1 X2 1 15 1 2
I have the following data test<-data.frame(group=1:10, var.a=rnorm(n=10,mean=500,sd=20), var.b=runif(10)) I would like a barplot with
I have the following data: a=c(1:10) b=c(16:25) c=c(24:33) wa=c(3,7,3,3,3,3,3,3,3,1) wb=c(3,2,3,3,3,3,3,3,3,8) wc=c(4,1,4,4,4,4,4,4,4,1) z=data.frame(a,b,c,wa,wb,wc) I want
I have the following dataframe: DF <- data.frame(x = c(1, 2, 3,NA), y =

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.