News for hackers. Stuff that matters.
Re:Why do we use R rather than Excel? by notafraudster on Sunday July 11, 2021 @10:09AM (#27800927)
You highlight four issues:

1. Documentation is accessible via the interpreter. You can type ?funcname to get documentation or ?libname for the entry point for almost every library, or use the Help tab in RStudio, the most common interpreter. Package documentation is typically hyperlinked text and of a high quality. You can also see syndicated versions of library documentation online in HTML format. Here is for instance, the HTML documentation for the stats library (the built-in library which covers most of the statistical functions you want): https://stat.ethz.ch/R-manual/R-patched/library/stats/html/0... or rdocumentation.org or really any dozens of web syndicated versions. The PDF version you mentioned is linked from CRAN, the package repository, but is by no means the only entry point for documentation.

2. The print function -- actually not a single function, but rather a commonly implemented S3 method -- is easy to understand if you understand how the S3 object system in R works and how function dispatch works. What it does depends on the class of the object and whether an S3 print method has been implemented for the class of the object. This is true in most languages. If you're looking to something closer to a bare metal print function you should consider cat, but in general I don't find print confusing at all.

3. The subset operators available in R are documented. Because everything is a function in R, you can easily see the documentation by typing ?`[` or ?`[[` -- both have the same documentation page, which describes the essential difference between the two subsetting operators. This is tricky to learn at first but given that the two operators do different things, both desireable in different contexts, it's sort of difficult to argue this is an ergonomics issue and not a user error. If you want a more hands on discussion of the differences, you can try http://adv-r.had.co.nz/Subsetting.html

4. Assignment, similarly, is documented. You can check ?`=` if you have some concerns or read the documentation online here: https://stat.ethz.ch/R-manual/R-patched/library/base/html/as... The short version is that although <- is idiomatically preferred by style guides, there are basically no contexts where = would do anything different. You may want to be aware of -> and <<- as other assignment operators. The former allows right hand assignment, which is a fun bit of syntax, and the latter overrides the default assignment scope and forces a global which I personally find distasteful.

One final note: the inner workings of any R function for which the implementation is in R can be inspected. Simply type the name of the function and press enter to see the source code of the function. A lot of low level stuff is implemented in C, so you'll find a stub function that calls internal things, but for almost anything else, this is a good way to learn how things work. Like, run-length encoding is implemented in the rle function so just type rle and press enter and voila, you see the full implementation.

R has a number of core language issues and things that are annoying but the ones you named read like you puttered around for 10 minutes and didn't do the kind of basic homework you need to do to learn a new language. I wouldn't complain about what a bad language Go is because I don't understand the distinction between := and = as assignment operators.

Re:Why do we use R rather than Excel? by eatonphil on Sunday July 11, 2021 @11:20AM (#27801498)
The syntax issues yeah that was a mistake to include. Although my confusion about = and <- was that I also wasn't getting warnings when using it incorrectly. In Go I cannot mistakenly use = for declaring a variable (without using 'var').

Far more severe is the scant documentation online.

Don't take this as an attack on the language or community. I'm a huge fan of Standard ML and it's arguably in a worse state!

I was interested in supporting R in the first place because I knew of its importance (if only vaguely).

Re:Why do we use R rather than Excel? by wheelinsupial on Sunday July 11, 2021 @03:52PM (#27804063)
Do you mean a lack of documentation on syntax or lack of documentation on statistical methods?

If it’s statistical methods, then you’ll need to look outside of R because R documentation isn’t trying to teach statistical methods.

You can try [1] the series of books teaching statistical methods using R.

In my stats degree we learned R methods alongside the statistical methods. R, to us at the undergrad level, is a fancy calculator. Yes it has functions and can do some “programming,” but it’s purpose is to facilitate using statistical methods and writing up reports.

If the audience of your IDE is programmers who want to do data analysis, then I think that’s a different audience than statisticians, who I think are the majority of users of R. R studio is already a decent IDE that statisticians are familiar with, so it might be a hard group to get to switch.

The syntax in R isn’t great. There are multiple ways of sub setting that depend on the data type you're subsetting.

Many of the top stats programs have notes on R or courses designed to teach R that are freely accessible on the internet.

[1] https://www.routledge.com/Chapman--HallCRC-The-R-Series/book...

Re:Why do we use R rather than Excel? by tylurp on Sunday July 11, 2021 @01:14PM (#27802692)
Really, really confused about your take on documentation. 9/10 you have documentation in the form of a pkgdown site with examples, parameter definitions, change log, articles, etc.

Here’s a good example: https://dplyr.tidyverse.org

Equally confused about your take on the community. R community is sort of a perfect example of an inclusive community actively trying to include everyone with organizations like “rladies” for women in tech.

Re:Why do we use R rather than Excel? by eatonphil on Sunday July 11, 2021 @03:42PM (#27804009)
In the first place, I went looking for information on assignment operators in R. There's no canonical source I can find. There's an ETH edu site that looks pretty old that seems to describe it well, but it's definitely still very minimal: https://stat.ethz.ch/R-manual/R-patched/library/base/html/as.... Is this even the right documentation? I don't know. (I'm not asking you, I'm sharing my thought process.)

Then I went looking for how to interact with JSON. There's no builtin library I guess but rjson seems to be what people use. There's no official documentation I can find on how to install a package but there are many blog posts. The rjson's only official documentation seems to be in PDF and again it's pretty minimal: https://cran.r-project.org/web/packages/rjson/rjson.pdf.

Again, to be fair, anyone looking into Common Lisp or Standard ML or OCaml would probably feel the exact same way about their ecosystems.

Does it cause a problem for existing users? Probably not. Is it the friendliest thing for first-timers to get into? Probably not. Is that a problem? Again probably not?

Re:Why do we use R rather than Excel? by wheelinsupial on Sunday July 11, 2021 @04:11PM (#27804203)
Are you using R or R Studio?

R: https://www.r-project.org/

There are manuals that you can find there.

R Studio (the IDE): https://www.rstudio.com/

R Studio cheat sheets: https://www.rstudio.com/resources/cheatsheets/

There is usually enough information on stack overflow / stack exchange to get through some questions. There is also a stats specific version that can sometimes be helpful. https://stats.stackexchange.com/

You are talking about documentation for user / community contributed packages. There is a minimum amount of standardization that needs to be followed, but yes, I do agree that the documentation could be better.

Hopefully this helps with installing packages: https://jtleek.com/modules/01_DataScientistToolbox/02_09_ins...

Re:Why do we use R rather than Excel? by eatonphil on Sunday July 11, 2021 @04:17PM (#27804244)
Thanks! I did end up figuring everything out this week I was trying to do (basics of syntax, 3rd party libraries, etc.). I posted the original comment just to document my experience on the path to figuring out these basics.
Re:Why do we use R rather than Excel? by tylurp on Sunday July 11, 2021 @04:21PM (#27804272)
Ah, okay agreed. Documentation on base R isn’t great. I was more so coming from the perspective of packages which I realize isn’t the full picture.

Regarding first timers, I think that once they’re aware of RStudio and the content they put out, learning becomes much more friendly and modern.

Still, I definitely agree and would appreciate a modern manual on base R.