Hello all,

I second Steve (although I personally use `<-` even when teaching). ;)

R is a tool more than a programming language (no troll intended -- I
love both Python and R, for different reasons).

I recently taught R lessons, one at a genomics-focused Data Carpentry
workshop, the other at an R-based Software Carpentry workshop (in this
order).  I have to say that the first experience was surprisingly
rewarding (starting from zero and getting somewhere), while the second
one was surprisingly frustrating (starting from zero and... explaining
boring concepts, pardon my exaggeration).  It felt so *forced*, such
an artificial translation of the Python lesson...  I'm definitely
biased, coming from the original (Python-based) Software Carpentry
material, and having taught the amazing genomics R lesson right
before.

Cheers,
Marianne

On Thu, Mar 31, 2016 at 1:20 AM, Steve Haddock <[email protected]> wrote:
>
> I would say I have intermediate to high experience with R, and have taught it 
> a few times. Even so, although I feel I could come up with a working solution 
> for most random questions, I am still not very confident that I will be 
> giving the optimal Hadley-approved R-like solution (probably involving plyr 
> !). It is going to take more than reading a book to reach that comfort level.
>
> I think the proper mindset for R is *totally* different than Python or most 
> other languages, and I would not lump them together in any way. You can't 
> think "how would i do this in Python?" and then try to translate that 
> straight into R language. Your Matlab experience is going to be the best 
> guide. In R if you are using a for loop you are almost always "doing it 
> wrong".
> So using vector operations, Boolean subsetting, and taking advantage of the 
> power of dataframes are the keys to getting off on the right foot.
> There are plenty of syntactical differences, but these are things you can 
> learn pretty quickly.  For example, to grab the 2nd up to the last item of a 
> series, you wouldn't use x[2:end] but would use  x[-1] (negative indices 
> meaning leave those out).
> For teaching, I would also go the sacrilegious route of using = instead of <- 
> as the assignment operator. A few laudable books actually use this too.  The 
> "proper" way is just visually confusing and extra keystrokes.
>
> The power of R and the situations where you would choose it over Python 
> (pandas notwithstanding) are pretty clear when you get down to it.
>
> Data visualization is a great way to impress people that there are viable 
> alternatives to spreadsheets. I had a fun experience of replacing my friend's 
> GUI graph generation workflow with about 3 lines of R code to plot his 
> dataset and colorize each point by another factor -- stuff he had to 
> regenerate each time with a few dozen clicks. You also could start by 
> focusing on getting their data into R as effectively as possible,  using 
> factors and dataframes, along the lines of Hadley's tidy data paper.
>
> -Steve
>
> ----- q•b -----

_______________________________________________
Discuss mailing list
[email protected]
http://lists.software-carpentry.org/mailman/listinfo/discuss_lists.software-carpentry.org

Reply via email to