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_schwa...@me.com> wrote: > >> On Apr 5, 2017, at 11:34 AM, Tunga Kantarcı <tungakanta...@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 > ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.