# Where to learn about R packages?

Questions about R packages are off-topic on SO, and since programming questions are off-topic on CV, a fortiori packages questions, which are about programming (in R) are off-topic on CV. That's why I always ask questions on algorithms (on SO), even if I often would much rather be pointed to a package. However, learning about packages is an integral part of doing statistics with R. Is there somewhere on Stack Exchange where I can ask question about which R package to use for a specific statistical inference problem? If not, as you guys are statistical experts, and many of you use/have used R, where do you go when you need advice about packages? Other than the R-help mailing list.

• You ask about R. I'd like to suggest that the question is generic and that discussion could reasonably be extended to any query about what general or specific software is available for statistical purposes. – Nick Cox Feb 3 '17 at 13:32
• Why other than R-help? As a matter of curiosity, are these questions on- or off-topic there? Are you excluding it because it is an obvious answer, or because it would be an unsatisfactory answer? (No axe to grind here; I have used R only occasionally.) – Nick Cox Feb 3 '17 at 13:46
• The CRAN task views are often a good place to start. But are software recommendations off-topic? See Are Software Recommendation Questions Off-Topic for this website? & Redirecting “looking for package in R” to SO. @whuber's comment here seems very pertinent. – Scortchi - Reinstate Monica Feb 3 '17 at 14:16
• @Scortchi thank you very much for your links, but I'm a bit confused. whuber's answer in your first link basically says that a question specifically on R would be "limiting and repetitive". I cannot however pose a general question, because I cannot learn (and/or buy) another software. On the other hand, whuber's comment seems to indicate that a question on [1/2] – DeltaIV Feb 3 '17 at 17:23
• [2/2] R packages may be ok on CV. To make a practical example, 1. do you think that this question would be on topic on CV? 2. Would it still be on-topic if instead of asking for an algorithm, I would ask for an R package? That would be much more useful, because I don't trust myself much with implementing a complicated geometric MCMC in R, but I would definitely trust the implementation in a released and tested CRAN R package. – DeltaIV Feb 3 '17 at 17:27
• @NickCox, you ask why I specify "other than R-help". I did write the reason why in the first version of this post, but I then deleted it because I was afraid of starting a controversy. Anyway, I'll bite: the reason is that the environment is in my limited, personal experience, more welcoming on CV than on R-help. – DeltaIV Feb 3 '17 at 17:30
• Questions about R packages are off-topic on SO?? Don't people ask package-specific questions on SO pretty much constantly? (e.g., "how do I do this thing in ggplot2") – Jake Westfall Feb 4 '17 at 1:06
• @JakeWestfall - Maybe an issue with asking for package recs? (Question is too open-ended) – Hao Ye Feb 4 '17 at 2:56
• @JakeWestfall unfortunately, asking for package recommendations is off-topic on SO. Asking a question about an issue with using a specific package is on-topic, but asking "which package can I use to do Bayesian inference for this complex statistical model" is off-topic. [1/2] – DeltaIV Feb 4 '17 at 10:56
• [2/2] Googling around, I found out that also Ben Bolker noted that packages have a bigger weight in R programming than in other languages, so he asked if there was a way to make an R-package related question on topic on SO, but the answer was basically no. – DeltaIV Feb 4 '17 at 10:58
• @NickCox when people ask for a specific package on R-help they usually get told how to use the search tools with varying degrees of politeness. – mdewey Feb 4 '17 at 16:39
• @DeltaIV I'd say that question is on-topic here. It's not really about R packages as much as it's about sampling algorithms anyway. – shadowtalker Feb 4 '17 at 19:55
• @mdewey That's what I used to hear a few years ago; I wasn't clear whether it still held true. To be fair, every forum I know about that is worth anything (including here) does have an expectation that you try basic searches first. – Nick Cox Feb 4 '17 at 20:40
• Quite so; it was a highly general comment; thanks for reading it that way. – Nick Cox Feb 5 '17 at 17:13
• A question is much more likely to be well-received if it's structured as "Given a, how do I do x?" instead of "What package can I use for x?" Note the former requires context/data (a) and is answerable with a demonstration, whereas the latter would just be answered with a list. The content of x determines whether the question belongs on SO or CV. Packages may be necessary for x, and answers will use them in passing. – alistaire Feb 8 '17 at 14:56

I believe we can all agree that a question like

Is there an R package for fitting Random Forests?

not only is off-topic but also shows a lack of research effort.

And likewise we can all agree that

randomForest::randomForest(...) gives me an error. How can I fix it?

is also off-topic, and at best belongs on StackOverflow.

Now consider a question like:

How do the rpart and party packages differ? Which one is preferred off-the-shelf for classification?

I would say this question is a good question for CV, because while, yes, its focus is restricted to R packages, it is actually a question about statistical computing. It is not about programming as such (i.e. it doesn't belong on StackOverflow), and while it is asking for a software recommendation I would say it's still topical enough to not kick it over to SoftwareRecs, where I imagine there is much less domain expertise floating around anyway.

There might be a gray area here with a question like:

What is the difference between caret and mlr? How do they compare to scikit-learn in Python? What are the strengths and weaknesses of each?

because it's not really about statistical computing. But I (as an opinionated poster without moderator privileges) would still say it's on-topic, because it's about statistics-specific methods and workflows. (Note that this question would also probably be closed as "too broad", but I still think it gets the right idea across.)

Finally, on to a question that I hope captures the spirit of the one you linked to in the comments (https://stackoverflow.com/q/42022917/2954547):

What R package should I use for outlier detection?

As stated, this question would rightfully be closed as either "opinion-based" or "too broad". But what is the question really trying to ask? I would argue that the question could have been phrased as

What are the current popular outlier detection techniques, and which of them are readily available in R?

and that this would be on-topic here. The question isn't really about R, it's about statistical modeling, with an added requirement that the model have an R implementation. This, I think, is what you are asking in your question on StackOverflow:

Of the MCMC samplers available in R, which one should I use for this problem and why?

which has more or less the same flavor.

• +1, this does a very good job of capturing the various nuances involved in what questions are on- / off-topic & why. (IMHO, your caret vs. mlr example question would be too broad to be on topic here although it does have real statistical content.) – gung - Reinstate Monica Feb 5 '17 at 17:29

Not arguing that ssdecontrol has an excellent answer, but as someone who is very interested in R packages, I find that subscribing to R-bloggers is really, really, useful. It will keep you in touch with what is new in the R package world as well as linking to blogs describing the use of various R packages.