Is there an Emacs mode for rscript?

Is there any emacs mode for Rscript ?

( Rscript is the script interface for R. )

If I type this:

 #!/usr/bin/Rscript print(commandArgs(TRUE)) 

and do indent in ESS R-mode, it discards the first line as crazy since it sees it as a comment:

  #!/usr/bin/Rscript print(commandArgs(TRUE)) 
+6
r emacs ess
source share
4 answers

No, but you can force Rscript into R editing mode by making the second line of the file as follows:

 # -*- mode: R -*- 

(Read more here .)

+1
source share

Starting with version 5.9, ESS recognizes scripts using an Rscript interpreter or translator; see http://ess.r-project.org/Manual/ess.html#New-features .

For reference, to assign a mode to the interpreter, use the interpreter-variable-type-alist. For example,

 (add-to-list 'interpreter-mode-alist '("Rscript" . r-mode)) 

Any file with the first line of type "#! / Usr / bin / Rscript" will be recognized as r-mode.

+2
source share

Try shell- script -mode - with an indent note

It perfectly formatted your code for me.

0
source share

If you just want to comment out a line, use "##" instead of "#". Double # will put the line in position.

0
source share

All Articles