8 ms·
Introducing R to a non-programmer in one hour
- danso 13y agoThere's not much you can actually teach to someone in an hour, especially about programming. So much of it is dependent on other computer skills...I once taught a class for five hours of introductory programming, and while some people learned things, we were frequently caught up in things like people saving filenames of "folder/hello.rb"...that is, the forward-slash was part of the filename, not the path...which I didn't even know was possible on any platform. But what you can get across, and the OP seems to have done this, is how accessible programming can be. I don't know about RStudio, but jumping into a REPL is easy enough in any modern languages, as is running a script. We take it for granted, but very very few people who haven't programmed realize that a "program" is simply composed of text. Hell. most people don't understand that about web pages. So even if you won't teach much in an hour, overcoming that intimidation factor of "where/how do I even start?" is still pretty huge.
- minimaxir 13y agoRStudio is the best IDE I've ever used and I wish something like that existed for other programming languages. The default workspace is split into the script, data, terminal, and meta (files/charts/help), and selecting a data frame variable will display it in a formatted window, making it very, very easy to debug data issues (I'm attempting to switch from R to Python/pandas due to performance/package issues, and I'm having much more difficulty debugging code.)
- catinsocks 13y agoCheck out Spyder if you are doing Science stuff with python: https://code.google.com/p/spyderlib/ https://code.google.com/p/spyderlib/
- minimaxir 13y agoActually, that looks right up my alley. Thanks!
- Fomite 13y agoRStudio is amazing - and has been key to several of my colleagues stepping away from SAS and toward R.
- dded 13y ago> that is, the forward-slash was part of the filename, not the path...which I didn't even know was possible on any platform Nor did I. Which platform?
- danso 13y agoDon't remember for sure, might have been a Windows machine. I just tried it on my Mavericks OS X. It was allowed, but instead of: sdf/index.html it auto-translated to this: sdf:index.html (i'm assuming that's not a Sublime Text 3 thing, which is what I just tested on)
- dded 13y agoThis fails on a Mac (10.9) and on CENTOS5 (2.6.18): #include <unistd.h> #include <fcntl.h> #include <stdio.h> int main() { int fd = creat("foo/bar", 1); if (fd == -1) { printf("error\n"); } else { close(fd); } return 0; }
- deleted 13y ago[deleted]
- craigching 13y agoNice, brief, introduction to R. If I might be so bold, I might suggest taking the Coursera "Computing for Data Analyis" class. It's only 4 weeks long and the first lesson covers everything in this blog post and more (I'm actually taking this class now). Though the first class is a bit longer than one hour (but not by much!).
- VLM 13y agoAs an intro, its well written and documented. If there is a fail, his sister is a senior in sociology and she "must have" already done significant statistical analysis in class... right? At the very least did some averages using her calculator in high school or something? So there should be substantial opportunity for compare/contrast, assuming his sister is compatible with this learning technique and the author knows anything about what the sister already knows. That would make a remarkably awful non-specific general population introduction. Also some focus on what she's doing... I did not find generic screwing around with R to be particularly challenging, I found "how do I connect R to my enormous database cluster in an intelligent fast simple way" to be a huge problem when starting out. OK I can average and std dev five hand entered numbers, that's very easy, now how about a complicated multi-site relational database with 1M records? She may have a totally different challenge, like all her raw data is CSV format or something. R is fun once you climb that vertical learning curve wall at the start and generate your first live result. The learning curve is very easy after that first result.
- vcrash 13y agoThe author of this piece is a woman.
- VLM 13y agoLuckily it doesn't change my response in any way other than in addition to all the "he" translating to "the author" all the "she" should refer to "the author's sister". I'm a "he" who provided software support to my sister, so you can see the likely source of that assumption. No negative implication of her ability to successfully portray her chosen gender role intended. Also I think its lame to check out bylines to make sure I run stuff thru the right sexism filter; I clearly stated its a "good" article; not "good, for a girl" article, or "not up to the manly standards of excellence" article.
- pessimizer 13y agoYou don't have to run a "sexism filter" as long as you don't assume that every speaker (whether technical or not) is a man. If you think that the grammatically weird "they" or "he/she" is awkward, and "OP" or "the author" too cold, you've restricted yourself to checking bylines.
- dangoldin 13y agoNice post. I've recently been trying to get back into R with the goal of being able to replace Excel. For the basic stuff R is great but as you start doing more complicated things it takes quite a while to figure out to do them in R. This is a part of the learning curve.
- dded 13y agoI really like Excel for adding up columns of numbers. Any task where you want to see the data (and the quantity of data is low enough to realistically be seen) and the operations performed on the data are relatively simple and straight-forward. But once the operations start getting more involved, I really start disliking Excel (or any spreadsheet). Excel shows the data but hides the formulas. At this point, I very much prefer a script.
- dangoldin 13y agoSomething I've been thinking about is an Excel frontend with an R backend. Each worksheet becomes a data frame so you can edit it in Excel and quickly apply some formula but you can also jump into an R console to do something more complicated.
- jofer 13y agoHave a look at DataNitro for a similar idea with python as the backend: https://datanitro.com/ https://datanitro.com/ I've never used it, but it looks quite nifty. It would certainly be interesting to see something similar for R.
- jebus989 13y agoPer the comments on the article I'd also advise "<-" for assignment rather than "=", reasons (in no particular order): 1) Google says so: http://google-styleguide.googlecode.com/svn/trunk/Rguide.xml http://google-styleguide.googlecode.com/svn/trunk/Rguide.xml 2) It's the accepted convention of the language. When she looks things up of SO, they'll use it; if she looks at a package's source, they'll use it. 3) In RStudio it's "option+hypen" (Mac) to type the four-character " <- ", so no extra typing required. 4) Statistically-speaking, things like x = x + 1 makes no sense 5) You need "<<-" for the occasional global 6) 2 -> x
- anaphor 13y agoAlso, a language shouldn't use the same operator for declaration (initialization in dynamic languages) and assignment imho.
- alecdbrooks 13y agoJust to be clear, R doesn't ever use the same operator for both, it uses == for comparison like C and Python. That being said, extra differentiation is a bonus.
- flyingbrotus 13y ago"The operators <- and = assign into the environment in which they are evaluated. The operator <- can be used anywhere, whereas the operator = is only allowed at the top level (e.g., in the complete expression typed at the command prompt) or as one of the subexpressions in a braced list of expressions."
- xerula 13y agoAlso "=" is compulsory for setting some named function arguments that have a default value. E.g. format(pi, digits <- 16) only prints with the default number of digits, format(pi, digits=16) works as expected. I think it's nice to have a syntax that distinguishes between object and argument assignment. Also you can do things like this when you're bored: ((a <- b <- 1) + 1 -> c) + 1 -> d (Someone also once told me that "=" for normal assignment sometimes fails in unexpected ways in tryCatch blocks, but I don't know how or why.)
- thrownaway2424 13y agoIn my experience, non-programmers are the only people who can grok R in the first hour.
- Fomite 13y agoMy own experience was that I came from statistical languages like SAS, bounced right off R, ended up learning Python and then came back to R and was like "ohhhh…" It's an odd language, that makes assumptions neither group really hold dear to their heart, but it's also intensely useful.
- noahmarc 13y agoFor someone with a programming background, this is one of the best introductions I've seen: http://medianetwork.oracle.com/video/player/2623621262001 http://medianetwork.oracle.com/video/player/2623621262001
- minimax 13y agoThat's a very good way of putting it!
- Crito 13y agoI'm not so sure. A few years ago in university I took a stats course (offered by the maths department) that had twice-weekly mandatory labs where we learned and used R. Most people in the course were not programmers at all, and I ended up helping people most of the time during the course. R is really weird, but non-programmers are typically unaccustomed to precisely typing non-english into a computer. They aren't trained to quickly spot syntax errors or grok error messages.