Calculate Growth Rate From a Vector of Stock Prices or...

Calculates vector of ratios of a numeric vector, i.e. ratio of x[2] to x[1], ratio of x[3] to x[2], and so forth.

1 | ```
ratios(x)
``` |

`x` |
Numeric vector. |

Numeric vector.

This function uses C++ code to achieve a 1.5-2 times speed increase compared to the base R code: len <- length(prices); prices[2: len] / prices[1: (len - 1)].

Dane R. Van Domelen

Acknowledgment: This material is based upon work supported by the National Science Foundation Graduate Research Fellowship under Grant No. DGE-0940903.

1 2 3 4 5 6 7 8 9 |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.