Skip to content
R for the Rest of Us Logo

R for the Rest of Us Blog

How to Create Multicolumn Layouts in RMarkdown

In a lot of the consulting work that R for the Rest of Us does , we do complex layouts of the sort are typically done with page layout software like Adobe InDesign. For example, in the reports we did on demographic and housing data in Connecticut , the charts were laid out in a complex grid across multiple pages. Or take a look at these reports , done in partnership with the Democracy Funders Collaborative's Census Subgroup and ORS Impact , that provide an overview of efforts to promote the...

How to Make a Diverging Bar Chart in R

Much of the credit for this blog post goes to Thomas Vroylandt . Before we began working together regularly , I made diverging bar charts but never really understood how things worked. Thomas has helped me truly understand how to make these visualizations. In a previous life, I worked in the world of program evaluation . In this work, I did a lot of surveys. And in these surveys, we often used Likert scales for answer options. For example: Question: How good is the education at your school?...

How to Set Your Default Package Install Location in R

One problem that people often have, especially when they work on Windows network drives, is that they can't install packages. This typically happens because they don't have admin rights on their computer and by default R tries to install packages into a location that requires admin rights. To see where your packages are installed to by default, type .libPaths() in the console and hit enter. If you use a Windows network drive, you may see something like this: This shows two paths: The first...

My R Journey: Ibrah Sendide

My name is Ibrah Sendide and I am a PhD candidate at the University of the Witwatersrand, Johannesburg. My work in health economics and outcomes research includes modelling cost effectiveness in health, statistical data analysis and econometric analyses. I recently completed the R in 3 Months program and wanted to share about my experience with it, and with R in general. When I came across David Keyes' Twitter profile , I saw that he made coding in R less daunting. A click on the link in...

How I Structure My RStudio Projects

During his presidency, Barack Obama famously wore only gray or blue suits ( with one minor exception ). In a 2012 interview with Vanity Fair, he explained why: I'm trying to pare down decisions. I don't want to make decisions about what I'm eating or wearing. Because I have too many other decisions to make. This idea of using routines to limit the number of decisions you have to make and save your brain's processing power for important choices applies well beyond the sartorial choices of...

How to Scrape Data with R

Those of us who work with R dream of just one thing: getting clean data, ready for analysis. Rarely does this happen, of course. As Steve Lohr wrote in the New York Times in 2014 , those working with data: spend from 50 percent to 80 percent of their time mired in this more mundane labor of collecting and preparing unruly digital data, before it can be explored for useful nuggets. Sometimes messy data comes in, ahem, creatively organized spreadsheets. Other times it comes as numeric values...

How to make interactive graphs in R

I recently got a question about making interactive graphs in R. Sara Kidd of the Hampton Roads Planning District Commission asked me the following : I am wondering what is the easiest/most efficient way to create interactive graphs and then embed them into a web page. While I will have a need for static graphs in reports, I will likely need to put some up on the website as well and I have been asked how to make them interactive (hover over with pop-ups, etc.). Thanks! The good news for Sara...

How to Use Git/GitHub with R

This blog post has gotten so much interest that I’ve turned it into a full-length course. Check it Out Using Git and GitHub alongside RStudio has the power to revolutionize how you work in R. But getting everything set up can be a challenge. Join me as I walk through everything you need to do in order to use Git and GitHub alongside RStudio. But first, some background ... What is Git? What is GitHub? I remember when I was starting out learning R, Git and GitHub were things I had heard about,...

Announcing pagedreport

tldr: Thomas Vroylandt and I have developed a package called pagedreport to help you make beautiful PDF reports from RMarkdown. Full documentation is available here . In a recent training, I showed the group I was working with various options for knitting RMarkdown documents. When I got to PDF, I showed the default output. One participant said, "oh yeah, I recognize that from math papers I read in undergrad." Of course, there are other formats you can knit to from RMarkdown, HTML and Word...

Parameterized Reporting with RMarkdown

Have you ever had to make a set of reports that all look alike? Perhaps you're making one report for each school in your district. Doing this manually is, I probably don't need to tell you, a huge pain. Fortunately, R has a solution to this problem: parameterized reporting . Parameterized reporting is a feature of RMarkdown that allows you to design a single report template and then use it to generate tens, hundreds, even thousands of reports at the same time. When I was starting to learn R,...