[Rd] Which programming paradigm is the most used for make R packages?

Barry Rowlingson b.rowlingson at lancaster.ac.uk
Thu Jan 4 11:52:05 CET 2007


Ross Boylan wrote:
> On Wed, Jan 03, 2007 at 11:46:16AM -0600, Ricardo Rios wrote:
>> Hi wizards, does somebody know  Which programming paradigm is the most
>> used for make R packages ? Thanks in advance.
>>
> You need to explain what you mean by the question, for example what
> paradigms you have in mind.
>

  Judging by the R code some people in our department write, the most 
used paradigm is 'bash something out that works and worry about 
paradigms later'-paradigm, used in conjunction with the 'write a very 
long .R file and source() it whenever you want to do 
something'-paradigm. This seems related to the 'write-first' paradigm, 
as opposed to the 'think-first' paradigm.

  Partly this is often due to the exploratory nature of working with R. 
You get a data set. You go 'okay, well, what's the mean of each 
column?', and do that. Then you wonder how A depends on B. Then you 
wonder how A depends on B given, ooh, C. Then you think, well, if I 
split the data into old and new measurements, rescaled by the median and 
offset by D, maybe something interesting appears. By now you've written 
40 lines of R code and its starting to get messy...

  By the end of the thesis, instead of a nice neat redistributable R 
package that would look great on CRAN, there's a whole pile of R code 
scattered around in various directories.

  How many statistics departments still teach programming to their 
undergraduates? We dropped Fortran about 10 years ago, nowadays they 
maybe type a few things into a script for Matlab in their second year, 
learn R at the end of year 2, and do a project perhaps with R in their 
third year. But they are expected to develop their own paradigm for 
working in R. I don't think the fundamentals of programming, let along 
the idea of paradigms (functional/OO/whatever) is introduced.

  Scary. And wandering off-topic.

Barry



More information about the R-devel mailing list