[R] Yield to maturity calculation - bndyield equivalent of MATLAB in R
Marc Schwartz
marc_schwartz at me.com
Wed Apr 5 19:28:59 CEST 2017
> On Apr 5, 2017, at 11:34 AM, Tunga Kantarcı <tungakantarci at gmail.com> wrote:
>
> Thanks a lot Marc, for informing that R is object oriented, implying
> that one should always try to vectorise the code (although I am not so
> clear why this should be the case) but also for all the references you
> provide.
Hi,
The reason for taking an object oriented approach using vectorized code, is that frequently, the R code that you write is internally calling compiled C code to perform the actual iterations over the object structure. Thus, being that compiled C code is much faster than interpreted R code, there is significant efficiency to be achieved by taking an object oriented approach to key operations.
In addition, when used, a single line of vectorized code and/or a vectorized function can replace multiple lines of code in a different language. Thus, from a coding efficiency and readability standpoint, it is far more efficient.
Regards,
Marc
More information about the R-help
mailing list