Sheffield_R_ July meeting - Interacting with R - IDEs, Git and workflow
-
Upload
paul-richards -
Category
Software
-
view
67 -
download
1
Transcript of Sheffield_R_ July meeting - Interacting with R - IDEs, Git and workflow
IDEs - huh? Why?
● IDE=integrated development environment● blurred line - many text editors have features
in this direction● syntax highlighting (at minimum)● integrated completion, help● …● Make your life easier!
Emacs
● Emacs is a very powerful text editor● Serves as an IDE for any code
(e.g. C++, python, …)● Heavy on keyboard shortcuts● Ships with ESS=Emacs Speaks Statistics for
interacting with R, S and SAS, which has been in development for 20 years
Emacs
Easily select and execute chunks
Integrated, executable help
E.g. C-c C-r execute region; C-enter execute line; C-c C-f re/load function
Integrated, executable help
Emacs: pros/cons
Pros● Amazingly powerful● Very efficient editing● Multi-code● Great if you already
use emacs● free/open, X-platform
Cons● Steep learning curve● You already use
another editor● RSI?!
Emacs
Some resources:
http://en.wikipedia.org/wiki/Emacshttp://ess.r-project.org/http://ess.r-project.org/refcard.pdfhttp://www.gnu.org/software/emacs/
TextMate WorkflowTextMate is a
“plain old” text editor (similar to SublimeText2) TextMate
Analysis scriptsRmd files
Shiny ui & server files
R shellsource(“file.R”)
runApp()
ShellknitRmd
make
Pros, Cons• Load up and tear down R
shells easily
• Easy to test code without polluting analysis workspace
• Can work on remote server with SSH
• Copy pasting to test code
• Time waiting for scripts to reload data (caching helps)
Tips• Script as much as possible with shell, R, perl etc.
• Makefiles make it easy to build workflows: https://github.com/mathew-hall/SheffieldR/blob/master/dplyr/Makefile
• Unix philosophy: Files/scripts/functions should do one thing and do it well
• Consider using virtual machines to package up your environment
• Emacs shortcuts work in R console (some in TextMate):• ^R back-search• ^A ^E jump to start, end of line• ^T,M-t transpose char, word• ^U,^K, ^Y,M-y kill to start,end of line, yank last killed text, cycle through killed text
R on the web - R-fiddle.org
• Don’t have access to R? Don’t panic!!!
• R-fiddle lets you use R in the cloud via your browser
• As name suggests - this is best for just fiddling….
• But you can embed the console into your own page
Click “save” to store code on their server
Use URL to retreive
Click embed to either embed just code, or code + console
Cool huh?!
Jupyter (in development)
• Building on iPython notebooks - interactive documents integrating Python code, graphics, text etc. Easy to write if you know JSON
• Although iPython can be extended to integrate R code, Jupyter extends the idea to numerous languages including R
• Still under development but R example notebook is viewable online