Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I "think OOP" when using R?

Tags:

r

I am a statistics graduate student who works a lot with R. I am familiar with OOP in other programming contexts. I even see its use in various statistical packages that define new classes for storing data.

At this stage in my graduate career, I am usually coding some algorithm for some class assignment--something that takes in raw data and gives some kind of output. I would like to make it easier to reuse code, and establish good coding habits, especially before I move on to more involved research. Please offer some advice on how to "think OOP" when doing statistical programming in R.

like image 358
osazuwa Avatar asked Jun 02 '11 04:06

osazuwa


1 Answers

I would argue that you shouldn't. Try to think about R in terms of a workflow. There's some useful workflow suggestions on this page:

Workflow for statistical analysis and report writing

Another important consideration is line-by-line analysis vs. reproducible research. There's a good discussion here:

writing functions vs. line-by-line interpretation in an R workflow

like image 56
Brandon Bertelsen Avatar answered Sep 29 '22 17:09

Brandon Bertelsen