Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Hating learning R any advice for a perl guy?

by igelkott (Priest)
on May 17, 2017 at 13:24 UTC ( [id://1190459] : note . print w/replies, xml ) Need Help??


in reply to Hating learning R any advice for a perl guy?

having to learn R

Had to do the same a couple years ago. Initially tried to minimize my expose to R with Statistics::R but was frustrated with the limitations on types of data structures which could be passed back and forth. Wrote my first R scripts in a C/Perl style with for loops, which resulted in painfully slow execution. In the end, I basically abandoned my Perl mindset and embraced vectors and implied loops. Simple Perl constructs can be so awkward in R that, in my opinion, it might be better not to think about Perl at all when learning R.

Basically, R is an interactive tools which can be scripted ... but that's not really what it's made for. Data types can change unexpectedly (eg, a single-column matrix silently changes into a vector) and array indexing calls a function. The trick is to find the R way to do things since those call C-functions rather than pure R.

I currently code in Perl, Python and R on a regular basis. I occasionally get mixed up but treating R like the completely unrelated language it is helped reduce the frustration.