0

I have two datasets : Here's the 1st, and Here's the 2nd.

My aim is to merge these datas, removing the 1st or 2nd "JN" column since it's recurring, and find the ratio of "Freq" between these datas.

For each Row, I want to use this calculation :

=(100)-(100*(FreqBL/FreqB))

and place this new calculation to 4th column.

The new data should look like:

JN  FreqBL  FreqB  Success Ratio
 4    10      33      69.6969

But I don't know how to select all rows seperately and the necessary code for the calculation.

Thanks

forochelian
  • 171
  • 2
  • 8

1 Answers1

2

You want to merge the data sets. For the next time, I will recommend you provide a small reproducible example.

> new.dt <- merge(dt1, dt2)
> new.dt$"Success ratio" <- with(new.dt, 100-(100 * (FreqBL/FreqB)))
> head(new.dt)
  JN FreqB FreqBL Success ratio
1  4    33     10      69.69697
2  8    49     10      79.59184
3 10    44     13      70.45455
4 11    38      7      81.57895
5 13    29      3      89.65517
6 17    15     10      33.33333
Roman Luštrik
  • 69,533
  • 24
  • 154
  • 197