5 ms·
I use R a lot and I have to say some of these comments are weird. 1. R and Lisp are hardly alike even if it was inspire by it. It's like saying Erlang and Prol
by digitalzombie 8y ago
I use R a lot and I have to say some of these comments are weird.
1. R and Lisp are hardly alike even if it was inspire by it. It's like saying Erlang and Prolog is very similar. If you want learn FP do it in Erlang, Lisp, Haskell, etc.. Don't do it in R, it's half baked.
2. R syntax is ugly with warts. But built in datatype like dataframe, factor type, NA (missing value notion) value, make this language much better than many languages out there for dealing with data. Subsetting dataframe is a breeze even in base R.
3. There are many many advance statistical packages only in R. GLMnet was was in R for 4-5 years before someone decided to port it to Python. You can argue that there might be alternative package. But the statistician that created ridge, elastic, etc... method made GLMnet. There are many statistician out there that just implement their latest method in R. If you want to learn a subject in statistic there is probably a book out there and it'll have an R package and code to come along with it. Next to that will be SAS. There are very few stat book with python packages. You want to learn bayesian statistic? Social Network Analysis? There's a book for it with R code and a package to do that. Good luck finding one in Python for these subfield of statistic. There's a bayesian hierarchical analysis in Ecology and that book is in R.
4. ggplot2 is amazing for static graphic. R doesn't have good dynamic graphic out there and I kinda meh with Shiney. If you hate the syntax then you may learn to appreciate it by reading it from the creator https://www.r-bloggers.com/a-simple-introduction-to-the-graphing-philosophy-of-ggplot2/ https://www.r-bloggers.com/a-simple-introduction-to-the-grap...
- sdabdoub 8y agoAbsolutely agree with #3. R is by far the most accepted and expected implementation language for statisticians. I remember reading a blog post where the author had submitted a manuscript to a statistics journal that ended up being rejected, in part, because he had implemented the code in julia instead of R. I use python for most things, but there are so many packages that can only be found in R (especially in the bioinformatics world), so it becomes a necessity.
- int_19h 8y ago> R and Lisp are hardly alike even if it was inspire by it. It's like saying Erlang and Prolog is very similar. If you want learn FP do it in Erlang, Lisp, Haskell, etc.. Don't do it in R, it's half baked. They are very alike in the underlying core design, not in how you use them. In R, everything is an expression, and every expression is a function call. Even things like assignments, if/else, or function definitions themselves, are function calls, with C-like syntactic sugar on top. You don't have to use that sugar, though! And all those function calls are represented as "pairlists", which is to say, linked lists. Exactly like an S-expr would - first element is the name being invoked, and the rest are arguments. And you can do all the same things with them - construct them at runtime, or modify existing ones, macro-style. So in that sense, R is actually pretty much just Lisp with lazy argument evaluation (which makes special forms unnecessary, since they can all be done as functions), and syntax sugar on top. Where it really deviates is the data/object model, with arrays and auto-vectorization everywhere.
- vertere 8y agoR certainly has a lispish code-as-data element to it, but it seems like it has some serious flaws. Don't most lisps have functions and macros as separate constructs? R has functions, but with some mucking around you can make them do macro-type stuff. Then people write these half-function, half-macro things (e.g. "non-standard evalation") that tend to break composability, either totally or sometimes only in edge cases.
- lispm 8y agoSomething like that would be called a FEXPR in Lisp. https://en.wikipedia.org/wiki/Fexpr https://en.wikipedia.org/wiki/Fexpr
- int_19h 8y agoLisps do that distinction because they need it. In R, you can do everything with functions, because arguments can be lazily evaluated, or you can even get the syntax tree used for that argument at call site instead. So in R, a macro is just a function. And yes, it's easy to break stuff that way. Just as easy as it is with macros (esp. non-hygienic ones).
- lispm 8y ago> Lisps do that distinction because they need it. Because of much better performance and predictability of code. See: http://www.nhplace.com/kent/Papers/Special-Forms.html http://www.nhplace.com/kent/Papers/Special-Forms.html
- int_19h 8y agoI'm not saying it's a better way to do things. It trades having fewer primitives (and hence simpler language structure) for performance. But the use of lazy evaluation is pervasive in R in general, so it's a conscious design decision that they made.
- Sean1708 8y agoDo you have an example of what R would look like without the C-like syntactic sugar? It doesn't need to be complex, I'm just intrigued about what it might look like.