If you already know another dynamic language and want to understand R, I would recommend skipping all the intros to R based around data analysis and start with Advanced R by Hadley Wickham. It will explain all the weirdness you'll encounter right up front before it confuses you. Then you can read the data analysis tutorials and focus on the content rather than the R weirdness.
I was quite surprised how easy that book was to read and understand. I’d expected “advanced” any language to be much more difficult.
Learn R Through Examples (2020)
11–20 of 68 posts
Re: Learn R Through Examples (2020)
#12I recently tried to migrate my R code to Julia. Even though I already knew R data.table is faster than DataFrames.jl, I was totally blown away by how slow Julia is. So I quickly gave up. I think I will have to write unavoidable hard loop in cpp, which I really don't want to do...
Re: Learn R Through Examples (2020)
#13I consider myself a pretty experienced developer/software engineer/whatever. Decade into my career, started in iOS in Obj-C, learned Swift along the way, eventually migrated to the backend with Java/SQL, and finally found myself where I really wanted to be, embedded doing C/C++ work for a household name. That said, about halfway through my master's about two years ago, I found myself in an intro to data mining course…
Everything? I'm just wondering what you've been doing exactly. I know that Tensorflow in R is just a wrapper on top of Python, not sure what else. If you're doing any deep learning, then going straight to Python is certainly much better than using R. For most other things it's not quite as clear of a decision.
Re: Learn R Through Examples (2020)
#14I consider myself a pretty experienced developer/software engineer/whatever. Decade into my career, started in iOS in Obj-C, learned Swift along the way, eventually migrated to the backend with Java/SQL, and finally found myself where I really wanted to be, embedded doing C/C++ work for a household name. That said, about halfway through my master's about two years ago, I found myself in an intro to data mining course…
What you described is a common phenomenon in stats / data mining / psychometrics / econometrics. They all need students to use certain programing languages, such as SAS / Stata / R / Python, but they don't really spend time to teach those programing languages. I guess this could also be the same for MATLAB in math?
There are people that know how to code but those are few and in-between. Usually they are pushed out of academic positions because there are very few ways to fund work to develop scientific code.
Re: Learn R Through Examples (2020)
#15Certainly R has its quirks, but most of this comes from being one of the oldest continuing existing programming languages there is. It derives from S which was written 46 years ago. Because of this it has multiple object/class systems reflecting the changing standards for OOP. It's most dominant one, S3, predates Java and therefore uses the Generic Function paradigm of OOP similar to Common Lisp's ClOS. If you're experienced but have never worked with non-Java style OOP you're going to be a bit confused.
R's most important feature, which is well worth studying and mastering for any serious programmer, is that it is a completely vectorized programming language. It borrows this style from APL (though is a million times more readable). Every value in R is a vector and for the vast majority of operations the best approach to solve your problem is by thinking in vector operations. This makes simple things like string formatting with `paste` seem like a confusing nightmare, but there is a real logic there. Functions like `ifelse` can seem strange, and writing C-style code in R, while possible will result in horrible performance.
Once you do learn to think in vectors you realize that R isn't just popular in the stats world because most statisticians haven't seen a "real" programming language, but because you can very rapidly iterate on models. Translating mathematical notation into R, for the experience R programmer, is easier than any other language I've worked with by a long shot.
My advice to any experienced programmer approaching R is to have some respect for the language. Most of the frustrations you'll have aren't because R is a bad language, but because you have less experience than you think and learning R well can expand your programming views in a similar way to Haskell.
Re: Learn R Through Examples (2020)
#16I recently tried to migrate my R code to Julia. Even though I already knew R data.table is faster than DataFrames.jl, I was totally blown away by how slow Julia is. So I quickly gave up. I think I will have to write unavoidable hard loop in cpp, which I really don't want to do...
Re: Learn R Through Examples (2020)
#17Lot's of negative comments in here about learning R from experienced programmers. I've found this is largely because experienced programmers have this unjustified bias that R is some toy language that should be easy to learn and has nothing to teach them. If you approached a language like Rust in the same way you would likely be just as frustrated with it. Certainly R has its quirks, but most of this comes from being…
And R excels at doing statistics and data science. If you keep that mindset, I believe many will find that its an excellent programming language.
Re: Learn R Through Examples (2020)
#18R’s future is inseparable from the tidyverse. We need to just lump them together in any serious discussion of R.
I teach a graduate level R course mainly for economics and statistics majors. (My educational background and career are computer science and technical; while that may stereotype me into Python, I just love R.) I spend the first three weeks on base R, to convey language-essential concepts, like vectorized objects, then the rest of the course is tidyverse-centric.
Re: Learn R Through Examples (2020)
#19Lot's of negative comments in here about learning R from experienced programmers. I've found this is largely because experienced programmers have this unjustified bias that R is some toy language that should be easy to learn and has nothing to teach them. If you approached a language like Rust in the same way you would likely be just as frustrated with it. Certainly R has its quirks, but most of this comes from being…
We were essentially told "Install R Studio, then just copy and paste these library imports and you're good to go". Your description of a vectorized language makes total sense, and that single paragraph is more of an intro to R than we ever got in class.
That said, I think the reason this happened with this class in particular is the viewpoint of (what I perceive) as the majority user's of R. Mathematics focused researchers who never learned the language, they just have done enough to get by and don't really appreciate the underpinnings, or the nuances of running an environment on a machine that isn't theres.
I can't entirely absolve myself of blame though, once I realized what was happening I should have gone and done some more foundational R learning, but at that point I just wanted to be done with the class.
Re: Learn R Through Examples (2020)
#20If you already know another dynamic language and want to understand R, I would recommend skipping all the intros to R based around data analysis and start with Advanced R by Hadley Wickham. It will explain all the weirdness you'll encounter right up front before it confuses you. Then you can read the data analysis tutorials and focus on the content rather than the R weirdness.