Calculating the Derivatives
calcDerivatives(data, column, groupby, time = NA, order = 2, window = 5)
data
: a data frame.column
: names of variables in the long format that correspond to multiple variables in the wide format.groupby
: Character vector. Only used if the data is in a data.frame.time
: A variable name in the data frame containing sampling time information.order
: integer scalar.window
: integer scalar.Must be an odd numbera data frame contains derivatives.
examples
#eg1.
derivatives1 <- calcDerivatives(data=example3,column='expected',groupby='year',order=2,window=5,interval=1)
#eg2.
derivatives2 <- calcDerivatives(data=example3,column=c('expected','current'),groupby='year',time='myTime',order=2,window=5,interval=1)
#eg3.
derivativese3 <- calcDerivatives(data=example3,column=c('expected','current'),groupby='year',order=2,window=5,interval=1)
Useful links