I Wasted Time with a Custom Prompt for R with ESS

I wanted a custom prompt for R with ESS. I wanted a double struck R. I probably did it wrong. It never worked. Actually it worked most of the time, and that is worse than never working. Kind people helped me. I still got it wrong. I take full responsibility. It was better not to do it. If you want to try, here is where I left it.


Make the ℝ prompt stand out (be sure to tell ESS how to handle this):

options(prompt="ℝ> ")


Tell ESS how to handle my custom prompt:

(setq inferior-ess-primary-prompt "ℝ> ")

Handle the custom ℝ prompt in ess. Don’t use custom here.

(setq inferior-S-prompt "[]a-zA-Z0-9.[]*\\(?:[>+.] \\)*ℝ+> ")

How to Format Magrittr Chains with ESS

Here is an example of how to format magrittr chains with ESS. Those interested will also be happy to learn of ess-R-fl-keyword:%op% and ess-%op%-face.

For example, to get the an indent after only the first statement.

(add-to-list 'ess-style-alist
               (ess-indent-level . 4)
               (ess-first-continued-statement-offset . 2)
               (ess-continued-statement-offset . 0)
               (ess-brace-offset . -4)
               (ess-expression-offset . 4)
               (ess-else-offset . 0)
               (ess-close-brace-offset . 0)
               (ess-brace-imaginary-offset . 0)
               (ess-continued-brace-offset . 0)
               (ess-arg-function-offset . 4)
           (ess-arg-function-offset-new-line . '(4))

(setq ess-default-style 'my-style)

Thank you Mr. Vitalie Spinu.


How I did it:

(setq gcr/ess-style
       (assoc 'RRR ess-style-alist)))
(setf (nth 0 gcr/ess-style) 'GCR)
(setf (cdr
       (assoc 'ess-continued-statement-offset
              (cdr gcr/ess-style)))
(add-to-list 'ess-style-alist gcr/ess-style)
(setq ess-default-style 'GCR)

Addendum: 2015-08-12

The latest version of ESS includes a RRR style.

It formats Magrittr chains as expected by default with ess-first-continued-statement-offset.

Some Lessons

To call in the statistician after the experiment is done may be no more than asking him to perform a post-mortem examination: he may be able to say what the experiment died of.
~ Sir Ronald Aylmer Fisher

The plural of anecdote is not data.
~ Roger Brinner

The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data.
~ John Tukey

Via r-help.

Teaching Statistics: A Bag of Tricks

This volume takes a positive spin on the field of statistics. Statistics is seen by students as difficult and boring, however, the authors of this book have eliminated that theory. Teaching Statistics: A Bag Of Tricks, brings together a complete set of examples, demonstrations and projects that not only will increase class participation but will help to eliminate any negative feelings toward the area of statistics.

How Students Learn Statistics

Research in the areas of psychology, statistical education, and mathematics education is reviewed
and the results applied to the teaching of college-level statistics courses. The argument is made that
statistics educators need to determine what it is they really want students to learn, to modify their
teaching according to suggestions from the research literature, and to use assessment to determine if
their teaching is effective and if students are developing statistical understanding and competence.

Some good projects or courses of study for R

Personal approach for collecting Emacs usage statistics advice?

Lately I’ve been curious whether or not my actual Emacs keymapping usage actually reflects how I think I use it. What I mean is that I have a goal of mapping frequently used operations to easily-accessible keybindings on the keyboard. What I plan to do is to record my usage so that I can study it to find mapping decisions that I got right, and wrong, and also identify things that I use that I should be mapping closer to home.

The simplest approach would be to use a keylogger, or advice inside of Emacs.

What I am curious about is your approach if you had done, or would do, something like this, and your thoughts an ideas.

In my case I lay out my mappings for how far away from home they are, and that has worked well so far, but I would like some numbers to back up that claim though it is not too serious depending upon how you look at it.

Cross posted from help-gnu-emacs