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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T23:35:28+00:00 2026-06-10T23:35:28+00:00

df av bv tv u l value s 30 120 360 330 210 6600

  • 0

df

av  bv  tv   u   l value           s
30 120 360 330 210  6600 0.005238424 
35 125 360 325 200  6875 0.005028887
40 130 360 320 190  7150 0.004835468
45 135 360 315 180  7425 0.004656377
50 140 360 310 170  7700 0.004490078
55 145 360 305 160  7975 0.004335247
60 150 360 300 150  8250 0.004190739
65 155 360 295 140  8525 0.004055554
70 160 360 290 130  8800 0.003928818
75 165 360 285 120  9075 0.003809763
80 170 360 280 110  9350 0.003697711

dput(df)

df<-structure(list(av = c(30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 
80), bv = c(120, 125, 130, 135, 140, 145, 150, 155, 160, 165, 
170), tv = c(360, 360, 360, 360, 360, 360, 360, 360, 360, 360, 
360), u = c(330, 325, 320, 315, 310, 305, 300, 295, 290, 285, 
280), l = c(210, 200, 190, 180, 170, 160, 150, 140, 130, 120, 
110), value = c(6600, 6875, 7150, 7425, 7700, 7975, 8250, 8525, 
8800, 9075, 9350), s = c(0.005238424, 0.00502888704, 0.00483546830769231, 
0.00465637688888889, 0.00449007771428572, 0.00433524744827586, 
0.0041907392, 0.00405555406451613, 0.003928818, 0.00380976290909091, 
0.00369771105882353)), .Names = c("av", "bv", "tv", "u", "l", 
"value", "s"), row.names = c(1L, 13L, 25L, 37L, 49L, 61L, 73L, 
85L, 97L, 109L, 121L), class = "data.frame")

df2

  av  bv  tv   u  l value
  30 120   0   0  0     0
  30 120  20   0  0     0
  30 120  40  10  0   550
  30 120  60  30  0  1650
  30 120 120  90  0  4950
  30 120 180 150 30  6600

dput(df2)

df2<-structure(list(av = c(30, 30, 30, 30, 30, 30), bv = c(120, 120, 
120, 120, 120, 120), tv = c(0, 20, 40, 60, 120, 180), u = c(0, 
0, 10, 30, 90, 150), l = c(0, 0, 0, 0, 0, 30), value = c(0, 0,
550, 1650, 4950, 6600)), .Names = c("av", "bv", "tv", "u", "l", 
"value"), row.names = c(1L, 2602L, 5203L, 7804L, 10405L, 13006L
), class = "data.frame")

All I want to do is add the df$s values in df to df2 where df$bv == df2$bv. df2 will have a lot more of the same bv values in df, so there will be some repetitive s values.

I was trying the following

     newDF <- ddply(df2, .(bv,tv), summarise, s = df[df$bv %in% df2$bv,]$s)

Although this is not working for me, maybe it’s because I don’t really understand the variable arguments in this function.

Really all other columns are arbitrary at this point, but I would like to keep the entire dataframe intact.

  • 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-10T23:35:29+00:00Added an answer on June 10, 2026 at 11:35 pm

    This will pull the corresponding ‘s’-items in ‘df’ into the matched rows of ‘df2’:

    df2$s <- df$s[ match(df2$bv, df$bv)]
    df2
    #-----------------------
          av  bv  tv   u  l value           s
    1     30 120   0   0  0     0 0.005238424
    2602  30 120  20   0  0     0 0.005238424
    5203  30 120  40  10  0   550 0.005238424
    7804  30 120  60  30  0  1650 0.005238424
    10405 30 120 120  90  0  4950 0.005238424
    13006 30 120 180 150 30  6600 0.005238424
    

    This is going to be a lot more efficient than ‘subset()’-ting and ‘merge()’-ing. Oooops. I didn’t see the plyr part. It’s going to be a lot faster than any plyr method, too, but that’s cuz’ I’m a base-R guy. If you want to do it with plyr then this delivers what I think you asked for:

    > newDF <- ddply(df2, .(bv), summarise, s = df$s[match(df2$bv , df$bv)])
    > newDF
       bv           s
    1 120 0.005238424
    2 120 0.005238424
    3 120 0.005238424
    4 120 0.005238424
    5 120 0.005238424
    6 120 0.005238424
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a simple way to move percentage pointer after the value: 120 @
First select query Table 1: ID Value 131 ABC 120 DEF Second select query
I have two numpy arrays with the dimensions (120, 360), one of the arrays
In my code i write the following line: return ((value / 120) * 1440).ToString();
how to cycle below values with javascript? 0, -120, -240, -360, -480, -600, -720
String registration=10-120; <input type=text name=registrationUpdate value=Reg# maxlength=50 /><br> In the above , value=Reg# which
table1_shard1 (1,000,000 rows per shard x 120 shards) id_user hash table2 (100,000 rows) value
I have a string: 116,118,120,130 and will want to delete either the first, last
Value is something like this: 12 23 345 3454 21 . I require to
What value do we get by using closures in JavaScript for implementing callbacks and

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.