[R] How to calculate the derivatives at each data point?

PIKAL Petr petr@p|k@| @end|ng |rom prechez@@cz
Tue Jan 31 10:58:10 CET 2023


Hi Konstantinos

Not exactly derivative but
> diff(df[,2])
[1] -0.01 -0.01 -0.01 -0.01  0.00  0.01 -0.02 -0.03 -0.02

May be enaough for you.

Cheers
Petr

>
> -----Original Message-----
> From: R-help <r-help-bounces using r-project.org> On Behalf Of konstantinos
> christodoulou
> Sent: Tuesday, January 31, 2023 10:16 AM
> To: r-help mailing list <r-help using r-project.org>
> Subject: [R] How to calculate the derivatives at each data point?
> 
> Hi everyone,
> 
> I have a vector with atmospheric measurements (x-axis) that is
> obtained/calculated at different altitudes (y-axis). The altitude is
uniformly
> distributed every 7 meters.
> For example my dataframe is:
> df <- dataframe(
> *altitude* = c(1005, 1012, 1019, 1026, 1033, 1040, 1047, 1054, 1061,
1068),
> *atm_values* = c(1.41, 1.40, 1.39, 1.38, 1.37, 1.37, 1.38, 1.36, 1.33,
1.31)
>                          )
> 
> How can I find the derivatives of the atmospheric measurements at each
> altitude?
> 
> I look forward to hearing from you!
> 
> Thanks,
> Kostas
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


More information about the R-help mailing list