In accordance with our meta agreement to restart the Language of the Month with the top-voted nomination from the old nominations list, we have a new featured language! Throughout September 2020, our Language of the Month, nominated by JayCe, will be:
R
What's a Language of the Month?
See the meta post for nominations. In short, during September, those who wish to participate should learn (at least the basics of) R, use it to solve challenges, and discuss it in the R chat room. Participation is completely optional, but is anticipated to be fun!
Information about R
R is a free software environment for statistical computing and graphics. It compiles and runs on a wide variety of UNIX platforms, Windows and MacOS.
It is a general-purpose language, meaning it can be used to answer all questions on this site. Though to be honest, processing strings requires a bit of flexibility.
Its vectorized syntax allows for concise answers in case of multiple input.
R is a functional programming language - almost everything is a function - including things that you would think (thanks to the parser) are just operators. This can yield some very powerful golfs, as displayed here.
Environments, combined with lexical scoping are a power feature of the language.
It is really good at plotting stuff.
And most importantly: Golfing R is fun :)
Documentation
- The official website has several online manuals, including An Introduction to R
- A list of resources for learning R
- Entry in the showcase of languages
- Golfing tips
(If you consider yourself knowledgeable in R and would like to help teach it to other users, feel free to join the R chat room!)
Interpreters
- Download for Linux, Mac OS X, or Windows
- Try It Online!
- RDRR (includes most of the packages available for R)
fivenum
,nextn
, andmatch
if I recall correctly), and I have a couple more in the Sandbox at the moment (jitter
andave
). I'm also toying with having people implement some statistical routines (e.g., given a dataset calculate the empirical CDF / Kaplan-Meier estimator for survival function) but I'm struggling with the I/O a little. \$\endgroup\$%>%
paradigm almost makes it into a different language variant to base R). Obviously, the usual need to includetidyverse::
,dplyr::
orlibrary(tidyverse)
would normally be a disincentive (especially for short challenges), but it would still be interesting to see whether a 'non-competing' R+tidyverse entry that omitted these characters could ever/often beat base R. Are you tempted to try? \$\endgroup\$library(magrittr)
could come in useful if you need to recycle expressions - example from the forward-pipe help:rnorm(100) %>% {c(min(.), mean(.), max(.))} %>% floor
. \$\endgroup\$