Questions tagged [r]

This challenge is related to the R language. Note that challenges that require the answers to be in a specific language are generally discouraged.

Filter by
Sorted by
Tagged with
58
votes
19answers
5k views

Tips for golfing in R

I'm looking for tips for golfing in the R statistical language. R is perhaps an unconventional choice for Golf. However, it does certain things very compactly (sequences, randomness, vectors, and ...
19
votes
5answers
4k views

What's the ugliest line of R code that still parses?

The goal is to produce a single line of R code that: Does as little as possible In as many characters as possible (max of 100 characters) And is as ugly as possible (where "ugly" can be taken to mean ...
7
votes
2answers
464 views

Total number of cells in R numeric dataframe

Problem statement The task is to write the shortest R statement to count the cells (rows * cols) in an instance of the R type numeric data.frame. For example, the <...
7
votes
3answers
643 views

What is a short code for generating this matrix in R?

I can see that it is 101 'moving to the right' but I cannot think of a short way to generate it in R language. \$\begin{bmatrix} 0 & 1 & 0 & 0 & 0 & 0 \\ 1 & 0 & 1 & 0 ...
0
votes
1answer
2k views

Plot gif of 3 dimensional heart in R [closed]

inspired by this blog: http://alstatr.blogspot.co.uk/2014/02/r-animating-2d-and-3d-plots.html I made a 2D gif of a heart with: ...