Hi,

I would like to apply this equation below and have no idea to code them in R.

Would anyone share how to code this equation in ?

Thank you.

X= (a/b)^ (10)/(a-b)

Hi,

I would like to apply this equation below and have no idea to code them in R.

Would anyone share how to code this equation in ?

Thank you.

X= (a/b)^ (10)/(a-b)

Confirm the result and group to make order of precedence for operators to work as expected, if needed.

```
find_X <- function(a, b) {
(a/b)^(10)/(a-b)
}
find_X(2,3)
#> [1] -0.01734153
```

Thank you for the code.

How should I apply with my dataframe?

Let say my dataframe with 'a' and 'b' column

And I would like to make a new column with a value calculated from the equation.

Thank you

A B New column

10 5

3 5

4 21

23 56

23 33

```
find_X <- function(a, b) {
(a/b)^(10)/(a-b)
}
(mydf <- data.frame(a = 1:3, b=2:4))
mydf$c <- find_X(mydf$a,
mydf$b)
mydf
```

1 Like

Thank you for the code.

It was really helpful.

Cheers,

MHA

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.