14
\$\begingroup\$

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

(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


cat("Happy golfing!")

\$\endgroup\$
13
  • 1
    \$\begingroup\$ This is very exciting, and (as one of the few [but hopefully about to become many] contributors in R) I'm very happy that R has been chosen. Apart from continuing to post anwsers in R, is there anything else that I could do to help or encourage others? \$\endgroup\$ Sep 2, 2020 at 15:59
  • 1
    \$\begingroup\$ I have in mind something like choosing a small selection of existing challenges that work well in R (so: not text-based challenges!), so that any/everyone that's interested could focus on the same set... \$\endgroup\$ Sep 2, 2020 at 16:00
  • 1
    \$\begingroup\$ @DominicvanEssen You can also post an R-themed challenge. In the past I've done a couple of challenges implementing some of R's more interesting built-ins (fivenum, nextn, and match if I recall correctly), and I have a couple more in the Sandbox at the moment (jitter and ave). 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\$
    – Giuseppe
    Sep 2, 2020 at 17:03
  • \$\begingroup\$ Also can we get a featured on here? \$\endgroup\$
    – Giuseppe
    Sep 2, 2020 at 17:08
  • \$\begingroup\$ @Giuseppe Makes sense to me, but I think a mod has to do that. \$\endgroup\$
    – DLosc
    Sep 3, 2020 at 0:38
  • \$\begingroup\$ @DominicvanEssen and Giuseppe: Please add your own September R solutions to the list below, too! (When you get the chance.) \$\endgroup\$
    – DLosc
    Sep 3, 2020 at 1:04
  • \$\begingroup\$ related: codegolf.stackexchange.com/questions/4024/tips-for-golfing-in-r \$\endgroup\$
    – JDL
    Sep 3, 2020 at 12:59
  • \$\begingroup\$ There is already a (now frozen) chatroom for golfing in R: chat.stackexchange.com/rooms/81960/golfr ; shouldn't we resuscitate it rather than open a new chatroom? \$\endgroup\$ Sep 3, 2020 at 13:12
  • \$\begingroup\$ @RobinRyder Well, shoot. I tried to look for one, but "R" is impossible to search for, so I didn't find it. I could see about getting that unfrozen. There's no content to speak of in the new one yet. \$\endgroup\$
    – DLosc
    Sep 3, 2020 at 23:55
  • \$\begingroup\$ @DLosc Sounds good; if you can get in unfrozen, I am sure a few of us regular R golfers can keep it active. \$\endgroup\$ Sep 4, 2020 at 17:31
  • 2
    \$\begingroup\$ As a frequent tidyverse user, I'm curious if anyone has a tidyverse answer that beats a base R answer. \$\endgroup\$
    – qwr
    Sep 5, 2020 at 22:06
  • 1
    \$\begingroup\$ @qrt I never use it normally, but I'd also be interested to know if it could be golf-competitive (especially as the %>% paradigm almost makes it into a different language variant to base R). Obviously, the usual need to include tidyverse::, dplyr:: or library(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\$ Sep 6, 2020 at 8:11
  • 1
    \$\begingroup\$ 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\$
    – Cong Chen
    Sep 11, 2020 at 9:17

1 Answer 1

4
\$\begingroup\$

List of all R solutions posted in September

(First time posters highlighted in bold)


List of all R tips posted in September

  • add entries in the form:

      [<tip title>](https://codegolf.stackexchange.com/a/<answer-ID>) by [username](https://codegolf.stackexchange.com/users/<user-ID>)
    

List of R-related challenges posted in September

  • add entries in the form:

      [<challenge title>](https://codegolf.stackexchange.com/q/<question-ID>) by [username](https://codegolf.stackexchange.com/users/<user-ID>)
    
\$\endgroup\$
3
  • \$\begingroup\$ This should be Community wiki, right? \$\endgroup\$
    – Razetime
    Sep 2, 2020 at 6:52
  • \$\begingroup\$ @Razetime Good idea, I'll do that. \$\endgroup\$
    – DLosc
    Sep 3, 2020 at 0:36
  • 1
    \$\begingroup\$ I will be awarding a 50 rep bounty to all first-time R golfers during that period. Please ping me if you add an eligible answer to the list! \$\endgroup\$ Oct 5, 2020 at 16:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .