getSpeed | R Documentation |
getSpeed(df)
df |
##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
function (df)
{
lf <- 7
ldf <- tail(df, lf)
lmdf <- lm(ldf[1:(lf - 1), ]$Adjusted ~ index(ldf[1:(lf -
1), ]$Date))
lmdff <- lm(ldf[2:lf, ]$Adjusted ~ index(ldf[2:lf, ]$Date))
return(as.numeric(lmdff$coefficients[2]) - as.numeric(lmdf$coefficients[2]))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.