Create an equation in R

Hi!, I'm looking help for this question.

I have the following matrix.

t	n
0	10000
10	8812
20	7763
30	6841
40	5998
50	5309
60	4669
70	4138
80	3656
90	3235
100	2870

¿How can I apply the following equation?

eq

Please, help!

Are the data in a matrix or data frame? If in a data.frame:

library(dplyr)
df <- df %>% 
        mutate(x = (n - lead(n))/((lead(t) - t) * n))

If it's a matrix put as.data.frame before mutate

3 Likes

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