[R] Yield to maturity calculation - bndyield equivalent of MATLAB in R

Tunga Kantarcı tungakantarci at gmail.com
Wed Apr 5 20:38:30 CEST 2017


OK this confused me. I thought object oriented coding should be
preferred because it allows cleaner, more efficient coding. But your
reply suggests it should be preferred because "R" is more efficient in
that way. Anyhow, this thread should indeed not become a discussion
point for this and I should read about it.


On Wed, Apr 5, 2017 at 7:28 PM, Marc Schwartz <marc_schwartz at me.com> wrote:
>
>> 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