By Jim R Tyson, on 16 June 2021
I am a massive fan of RStudio. Not just for R development and data analysis. I use RStudio a lot in writing learning materials, recently for R, but also for Pyton and Stata using literate programming techniques and the
learnr package (yes, you can include Stata code in markdown documents with a little work!)
There are a whole bunch of (no doubt wonderful) things in this Preview release that I haven’t yet bothered to look at, but somethings have got my immediate attention.
The visual markdown editor
I have mixed feelings about this. I know that visual editing – that is, something partway towards WYSIWYG, a la Word – is appreciated by lots of people, but I loathe it. I took up LaTeX a long time ago to get away from Microsoft Word (and, not to boast, I am a very proficient Word user). But, even I found that 90 per cent of the time, LaTeX was too complicated for what I needed. Hoorah for Markdown.
RStudio actually provided my first introduction to Markdown and I revelled in it from the beginning, especially combined with Pandoc: one source many ouputs! At last the world was beginning to understand. Write in one simple lightweight format and get HTML, PDF, DOCX and other formats automatically. And of course it put literate programming within easy reach of all R programmers and learners. With the learnr package writing R study materials is a breeze.
But, still some people don’t like plain text editing. Well, the 1.4 Preview shows off the new visual editor. It’s not a complete WYSYWIG offer like Word, but it does show you a live close to end-result preview and has menus to formatting, layout, tables, images, citations. If you really don’t like typing text this may be just what you are looking for to push you that last step into literate data analysis with R and RMarkdown.
Inserting citations with Zotero
Yes, zotero users can now use the source editor to insert citations with point and click – just like Word users. There is no need to first export the references to a BibTeX file first – RStudio handles that for you. Using BibTeX is another thing that people have sometimes mentioned when talking about the difficulty of writing in Rmarkdown.
New Python functionality
And then, oh joy, the new python functionality. I find that very few people are aware that it’s a breeze to combine Python and R code using Rmarkdown documents, although it may take some effort to understand all the set-up requirements for python chunks at first: it took me 15 minutes the first time I tried to run
import numpy as np!
Now, this new release adds tools for configuring python, conda and virtual environments. For me the real advance though is somewhat simpler: now you can see python data objects in the RStudio environment pane and view python dataframes in the normal way.
The last of the new features I know I will use is the introduction of ‘rainbow’ parentheses. Nothing to with Pride month apparently, just adding colour coded bracketing to help you balance your parentheses.
Time to give R (and Python) with RStudio another look
If the user interface has put you off moving to R and RStudio, then now is definitely a time to have another look. Especially for Stata users, complexity and ease of use really aren’t a reason to prefer Stata any more and the move to R coding really isn’t that difficult.