Showing posts with label rstudio. Show all posts
Showing posts with label rstudio. Show all posts

11.7.13

R Interface for Teaching

Kaitlin Thaney asked on Twitter last week about using Ramnath Vaidyanathan's new interactive R notebook 1 2 for teaching.

Now, to be clear up front, I am not trying to be mean to Ramnath, discredit his work, or the effort that went into that project. I think it is really cool, and has some rather interesting potential applications, but I don't really think it is the right interface for teaching R. I would argue that the best interface for teaching R right now is RStudio. Keep reading to find out why.

iPython Notebook

First, I believe Ramnath when he says he was inspired by the iPython Notebook that makes it so very nice to do interactive, reproducible Python coding. Software Carpentry has been very successfully using them for helping to teach Python to scientists.

However, the iPython Notebook is an interesting beast for this purpose. You are able to mix markdown blocks and code blocks. In addition, it is extremely simple to break up your calculations into units of related code, and re-run those units as needed. This is particularly useful when writing new functions, because you can write the function definition, and a test that displays output in one block, and then the actual computations in subsequent blocks. It makes it very easy to keep re-running the same block of code over and over until it is correct, which allows one to interactively explore changes to functions. This is awesome for learning Python and prototyping functions.

In addition to being able to repeatedly write -> run -> modify in a loop, you can also insert prose describing what is going on in the form of markdown. This is a nice lightweight syntax that generates html. So it becomes relatively easy to document the why of something.

R Notebook

Unfortunately, the R notebook that Ramnath has put up is not quite the same beast. It is an Ace editor window coupled to an R process that knits the markdown and displays the resultant html. This is really cool, and I think will be useful in many other applications, but not for teaching in an interactive environment.

RStudio as a Teaching Environment

Lets think. We want something that lets us repeatedly write -> run -> modify on small code blocks in R, but would be great if it was some kind of document that could be shared, and re-run.

I would argue that the editor environment in RStudio when writing R markdown (Rmd) files is the solution. R code blocks behave much the same as in iPython notebook, in that they are colored differently, set apart, have syntax highlighting, and can be easily repeatedly run using the code chunk menu. Outside of code blocks is assumed to be markdown, making it easy to insert documentation and explanation. The code from the code blocks is sent to an attached R session, where objects can be further investigated if required, and results are displayed.

This infrastructure supplies an interactive back and forth between editor and execution environment, with the ability to easily group together units of code.

In addition, RStudio has git integration baked in, so it becomes easy to get started with some basic version control.

Finally, RStudio is cross-platform, has tab completion among other standard IDE goodies, and its free.

Feedback

I've gotten some feedback on twitter about this, and I want to update this post to address it.

Hard to Install

One comment was that installing R, RStudio and necessary packages might be hard. True, it might be. However, I have done multiple installs of R, RStudio, Python, and iPython Notebook in both Linux and Windows, and I would argue that the level of difficulty is at least the same.

Moving from Presentation to Coding

I think this is always difficult, especially if you have a powerpoint, and your code is in another application. However, the latest dev version of RStudio (download) now includes the ability to view markdown based presentations in an attached window. This is probably one of the potentially nicest things for doing presentations that actually involve editing actual code.

Edit: added download links for Rstudio preview

16.8.12

Show me yours

romunov at “danganothererror” recently posted about his personal setup for working with R, and challenged others to post as well. Here is my setup.

I use RStudio, maximized on one monitor (I have a two monitor setup). This gives me multiple editor windows for scripts / function writing / package development, an integrated R command window, workspace & history browser, as well as files, plots, packages, and help. For working on multiple projects, I use the RStudio project feature, that keeps project specific information (directory, saved sessions if you want it, integrated git repos), and multiple desktops using dexpot on Windows.

RStudio also has markdown to html support directly, and they are adding a bunch of package development support, using a lot of the work Hadley Wickham has done with the excelent devtools package.

I like it a lot, and much prefer it over my previous Notepad++, npptoR, R gui setup.

Source markdown at https://github.com/rmflight/blogPosts/blob/master/showmeyours.md

Posted at: http://robertmflight.blogspot.com/2012/08/show-me-yours.html

20.1.12

RStudio New Features!

For anyone who is using RStudio, there are some new features to note in the next release (0.95).

1 - Multiple projects, multiple RStudio instances

If you are like me and often have large things running, and want to work on something else, then it is nice to be able to have multiple instances (copies if you will) of the editor and programming environment running. I often find myself working on multiple projects, and I don't like shutting down and coming back to something when all I really need is 10 minutes to work on the other thing. So I was very happy to see that you can now fire up multiple copies of RStudio. You can even tie particular instances of RStudio to a particular project, with its associated files, and history.

2 - Integrated version control

I admit, I don't use version control nearly as much as I should, I still tend to depend on keeping old bits of code in files and then running the pieces that I need. But version control has gotten a lot easier with integrated versioning in RStudio using Git or SVN. I had been using Mercurial, but due to the built in integration with Git, am switching over (not hard, I only had like one directory that was actually using vc). What is really sweet about it, is that you can just create a project based on a current directory, and say you want to use VC, and it will initialize it and restart RStudio, and you are good to go.
One reason I will be using Git over SVN is the ability to stick with local repositories, whereas SVN would require a whole server set up on my machine or somewhere else. And it seems pretty easy to use.

As of 1500 EST on 20/01/12, the download page still showed the old version, but the documentation for version control is up. If you want to get the version with projects and version control as a preview release here http://www.rstudio.org/download/preview.  

Edit: The new version is available on the main download page.