<p><div><div><div><div data-show-faces="false" data-height="21" data-width="100" data-layout="button_count" data-send="true" data-href="https://www.r-bloggers.com/automating-summary-of-surveys-with-rmarkdown/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="https://rviews.rstudio.com/2017/11/07/automating-summary-of-surveys-with-rmarkdown/"> R Views</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p>This guide shows how to automate the summary of surveys with R and R Markdown using RStudio. This is great for portions of the document that don’t change (e.g., “the survey shows substantial partisan polarization”). The motivation is really twofold: <em>efficiency</em> (maximize the reusabililty of code, minimize copying and pasting errors) and <em>reproducibility</em> (maximize the number of people and computers that can reproduce findings).</p>
<p>The basic setup is to write an <code>Rmd</code> file that will serve as a template, and then a short R script that loops over each data file (using <code>library(knitr)</code>). The <code>render</code> function then turns the <code>Rmd</code> into documents or slides (typically in <code>PDF</code>, <code>HTML</code>, or <code>docx</code>) by taking file metadata as a <a rel="nofollow" href="http://rmarkdown.rstudio.com/developer_parameterized_reports.html" target="_blank">parameter</a>.</p>
<p>There are countless ways to summarize a survey in R. This guide shows a few basics with <code>ggplot</code> and <code>questionr</code>, but focuses on the overall workflow (file management, etc.). Following the instructions here, you should be able to reproduce all four reports (and in principle, many more) despite only writing code to clean one survey. Most of the code is displayed in this document, but all code is found in either <code>pewpoliticaltemplate.Rmd</code> or <code>pew_report_generator.R</code>. All code, as well as the outputted documents, can be found <a rel="nofollow" href="https://github.com/rdrr1990/datascience101/tree/master/automating" target="_blank">here</a>, and details on obtaining the data are found below.</p>
<div>
<h1>Software</h1>
<p>RStudio’s interface with <code>library(rmarkdown)</code> is evolving rapidly. Installing the current version of RStudio is highly recommended, particularly for the previews of the R Markdown code (this doc was created with RStudio 1.1.83). (Here is my <a rel="nofollow" href="https://web.stanford.edu/class/stats101/" target="_blank">install guide</a>, which includes links to tutorials and cheat sheets. For somewhat more advanced survey data cleaning, click <a rel="nofollow" href="https://web.stanford.edu/class/stats101/R_skill_dRill.html" target="_blank">here</a>.)</p>
<p>Even if you’ve knit Rmd before, your libraries may not be new enough to create parameterized reports. I recommend installing <code>pacman</code>, which has a convenience function <code>p_load</code> that smooths package installation, loading, and maintenance. I’d recommend <code>p_load</code> particularly if you are collaborating, say, on Dropbox.</p>
<pre><code>install.packages(&quot;pacman&quot;)
p_load(rmarkdown, knitr, foreign, scales, questionr, tidyverse, update = TRUE)</code></pre>
<p>Remember <code>PDF</code> requires <code>LaTeX</code> <a rel="nofollow" href="https://web.stanford.edu/class/stats101/" target="_blank">(install links)</a>. By contrast, knitting to <code>docx</code> or <code>HTML</code> does not require <code>LaTeX</code>. Creating <code>pptx</code> is possible in R with <code>library(ReporteRs)</code>, but is not discussed here.</p>
</div>
<div>
<h1>The Data</h1>
<p>Download the four “political surveys” from Pew Research available <a rel="nofollow" href="http://www.people-press.org/datasets/2016/" target="_blank">here</a> (i.e., January, March, August, and October 2016). You may recall, some politics happened in 2016. (The data is free, provided you take a moment to make an account.)</p>
<ul>
<li>If need be, decompress each <code>zip</code> folder.</li>
</ul>
<p>Three of my folders have intuitive names (<code>Jan16</code>, <code>Mar16</code>, and <code>Oct16</code>), but one of my folders picked up a lengthy name, <code>http___www.people-press.org_files_datasets_Aug16</code>. Don’t worry about that.</p>
<ul>
<li>
<p>Create a new folder, call it, say, <code>automating</code>.</p>
</li>
<li>
<p>Move all four data folders into <code>automating</code>.</p>
</li>
</ul>
<p>Please note that I have no affiliation (past or present) with Pew Research. I simply think that they do great work and they make it relatively hassle-free to get started with meaningful data sets.</p>
</div>
<div>
<h1>The R Notebook (R Markdown) Template</h1>
<p>(R Markdown ninjas can skip this section.)</p>
<p>In RStudio, create a new R Notebook and save it as <code>pewpoliticaltemplate.Rmd</code> in the <code>automating</code> folder you just created. This document will likely knit to <code>HTML</code> by default; hold down the Knit button to change it to <code>PDF</code>. Add fields to the header as desired. The sample header below automatically puts today’s date on the document by parsing the expression next to <code>Date:</code> as R code. <code>classoption: landscape</code> may help with wide tables. You can also specify the file that contains your bibliography in several formats, such as <code>BibTex</code> and <code>EndNote</code> <a rel="nofollow" href="http://rmarkdown.rstudio.com/authoring_bibliographies_and_citations.html" target="_blank">(citation details)</a>.</p>
<p>Next add an R code chunk to <code>pewpoliticaltemplate.Rmd</code> to take care of background stuff like formatting. Though setting a working directory would not be needed just to knit the <code>Rmd</code>, the directory must be set by <code>knitr::opts_knit$set(root.dir = '...')</code> to automate document prep. (<code>setwd</code> isn’t needed in the <code>Rmd</code>, but setting the working directory separately in <code>Console</code> is recommended if you’re still editing.)</p>
<div>
<img src="https://i2.wp.com/rviews.rstudio.com/post/2017-11-01-Mohanty-Surveys_files/images/config.png?w=456&ssl=1" data-recalc-dims="1">
</div>
<p>The Play button at the top right gives a preview of the code’s output, which is handy. If some part of the analysis is very lengthy, it only needs to be run once, freeing you to tinker with graphics and the like.</p>
<p>– Now the default settings have been set and you don’t need to worry about suppressing warnings and so on with each code chunk. You can, of course, change them case-by-case as you like.</p>
<p>– Unlike in R, when setting the format options for individual code chunks (as shown above to suppress warnings before the defaults kick in), you do need to type out the words <code>TRUE</code> and <code>FALSE</code> in full.</p>
<p>– Unlike the template, in this doc, I’ve set the defaults to <code>echo = TRUE</code> and <code>tidy = TRUE</code> to display the R code more pleasingly.</p>
<p>– The setting <code>asis = TRUE</code> is very useful for professionally formatted tables (shown below), but is not recommended for raw R output of matrix and tables. To make raw data frames display with <code>kable</code> by default, see <a rel="nofollow" href="http://rmarkdown.rstudio.com/html_document_format.html" target="_blank">here</a>.</p>
<div>
<h3>The Template</h3>
<p>I find it easiest to write a fully working example and then make little changes as needed so that <code>knitr::render()</code> can loop over the data sets. First things first.</p>
<pre><code>survey &lt;- read.spss(&quot;Jan16/Jan16 public.sav&quot;, to.data.frame = TRUE)</code></pre>
<p>Summary stats can easily be inserted into the text like so:</p>
<div>
<img src="https://i2.wp.com/rviews.rstudio.com/post/2017-11-01-Mohanty-Surveys_files/images/intext.png?w=456&ssl=1" data-recalc-dims="1">
</div>
<p>The template contains additional examples with survey weights (lengthier calculations should be done in blocks of code and then their result referenced with that inline style).</p>
<p>Here is a basic plot we might want, which reflects the survey weights. <code>facet_grid()</code> is used to create analogous plots for each party identification. The plot uses the slightly wonky syntax <code>y = (..count..)/sum(..count..)</code> to display the results as percentages rather than counts. Note that some code that cleans the data (mostly shortening labels) is omitted for brevity, but can be found <a rel="nofollow" href="https://github.com/rdrr1990/datascience101/blob/master/automating/pewpoliticaltemplate.Rmd" target="_blank">here</a>.</p>
<pre><code>PA &lt;- ggplot(survey) + theme_minimal()
PA &lt;- PA + geom_bar(aes(q1, y = (..count..)/sum(..count..), weight = weight, 
    fill = q1))
PA &lt;- PA + facet_grid(party.clean ~ .) + theme(strip.text.y = element_text(angle = 45))
PA &lt;- PA + xlab(&quot;&quot;) + ylab(&quot;Percent of Country&quot;)
PA &lt;- PA + ggtitle(&quot;Presidential Approval: January 2016&quot;)
PA &lt;- PA + scale_y_continuous(labels = scales::percent)
PA</code></pre>
<div>
<img src="https://i2.wp.com/rviews.rstudio.com/post/2017-11-01-Mohanty-Surveys_files/images/ggPresApproval-1.png?w=456&ssl=1" data-recalc-dims="1">
</div>
<p>Here is an example of a weighted crosstab. <code>knitr::kable</code> will create a table that’s professional in appearance (when knit as <code>PDF</code>; <code>kable</code> takes the style of an academic journal).</p>
<pre><code>kable(wtd.table(survey$ideo, survey$sex, survey$weight)/nrow(survey), digits = 2)</code></pre>
<table>
<thead>
<tr>
<th></th>
<th align="right">Male</th>
<th align="right">Female</th>
</tr>
</thead>
<tbody>
<tr>
<td>Very conservative</td>
<td align="right">0.04</td>
<td align="right">0.03</td>
</tr>
<tr>
<td>Conservative</td>
<td align="right">0.14</td>
<td align="right">0.13</td>
</tr>
<tr>
<td>Moderate</td>
<td align="right">0.20</td>
<td align="right">0.20</td>
</tr>
<tr>
<td>Liberal</td>
<td align="right">0.08</td>
<td align="right">0.09</td>
</tr>
<tr>
<td>Very liberal</td>
<td align="right">0.03</td>
<td align="right">0.03</td>
</tr>
<tr>
<td>DK*</td>
<td align="right">0.02</td>
<td align="right">0.03</td>
</tr>
</tbody>
</table>
<p>Suppose we want to display Presidential Approval, where the first column provides overall approval and subsequent columns are crosstabs for various factors of interest (using the cell weights). I’ve written a convenience function called <a rel="nofollow" href="https://github.com/rdrr1990/datascience101/blob/master/automating/Xtabs.R" target="_blank">Xtabs</a> that creates this format, which is common in the survey world.</p>
<pre><code>source(&quot;https://raw.githubusercontent.com/rdrr1990/datascience101/master/automating/Xtabs.R&quot;)
kable(Xtabs(survey, &quot;q1&quot;, c(&quot;sex&quot;, &quot;race&quot;), weight = &quot;cellweight&quot;))</code></pre>
<table>
<thead>
<tr>
<th></th>
<th align="left">Overall</th>
<th align="left">Male</th>
<th align="left">Female</th>
<th align="left">White (nH)</th>
<th align="left">Black (nH)</th>
<th align="left">Hispanic</th>
<th align="left">Other</th>
<th align="left">DK*</th>
</tr>
</thead>
<tbody>
<tr>
<td>Approve</td>
<td align="left">45.6%</td>
<td align="left">21.3%</td>
<td align="left">24.2%</td>
<td align="left">20.4%</td>
<td align="left">9.48%</td>
<td align="left">10.2%</td>
<td align="left">4.97%</td>
<td align="left">0.443%</td>
</tr>
<tr>
<td>Disapprove</td>
<td align="left">48.5%</td>
<td align="left">25.5%</td>
<td align="left">23%</td>
<td align="left">39.6%</td>
<td align="left">1.33%</td>
<td align="left">3.95%</td>
<td align="left">2.53%</td>
<td align="left">1.12%</td>
</tr>
<tr>
<td>Don’t Know (VOL)</td>
<td align="left">5.94%</td>
<td align="left">2.67%</td>
<td align="left">3.27%</td>
<td align="left">3.39%</td>
<td align="left">0.646%</td>
<td align="left">1.14%</td>
<td align="left">0.489%</td>
<td align="left">0.269%</td>
</tr>
</tbody>
</table>
<p>Suppose we want to do many crosstabs. The syntax <code>survey$ideo</code> is widely used for convenience, but <code>survey[[&quot;ideo&quot;]]</code> will serve us better since it allows us to work with vectors of variable names ( <a rel="nofollow" href="http://www.win-vector.com/blog/2017/06/non-standard-evaluation-and-function-composition-in-r/" target="_blank">details from win-vector</a> ). Below, the first two calls to comparisons are identical, but the final one is not because there is no variable “x” in the data frame <code>survey</code>.</p>
<pre><code>identical(survey$ideo, survey[[&quot;ideo&quot;]])</code></pre>
<pre><code>[1] TRUE</code></pre>
<pre><code>x &lt;- &quot;ideo&quot;
identical(survey[[x]], survey[[&quot;ideo&quot;]])</code></pre>
<pre><code>[1] TRUE</code></pre>
<pre><code>identical(survey[[x]], survey$x)</code></pre>
<pre><code>[1] FALSE</code></pre>
<p>So say we want weighted crosstabs for ideology and party ID crossed by all question 20, 21, 22.. 29. Here is some code that will do that.</p>
<pre><code>x &lt;- names(survey)[grep(&quot;q2[[:digit:]]&quot;, names(survey))]
x</code></pre>
<pre><code> [1] &quot;q20&quot;  &quot;q21&quot;  &quot;q22a&quot; &quot;q22b&quot; &quot;q22c&quot; &quot;q22d&quot; &quot;q22e&quot; &quot;q22f&quot; &quot;q22g&quot; &quot;q22h&quot;
[11] &quot;q22i&quot; &quot;q25&quot;  &quot;q26&quot;  &quot;q27&quot;  &quot;q28&quot; </code></pre>
<pre><code>y &lt;- c(&quot;ideo&quot;, &quot;party&quot;)</code></pre>
<pre><code>for (i in x) {
    for (j in y) {
        cat(&quot;\nWeighted proportions for&quot;, i, &quot;broken down by&quot;, j, &quot;\n&quot;)
        print(kable(wtd.table(survey[[i]], survey[[j]], survey$weight)/nrow(survey), 
            digits = 2))
        cat(&quot;\n&quot;)  # break out of table formatting
    }
    cat(&quot;\\newpage&quot;)
}</code></pre>
<p>A few notes:</p>
<p>– This code will only work with the <code>asis</code> setting (shown above) that lets <code>knitr</code> interpret the output of <code>print(kable())</code> as something to render (rather than just Markdown code to display for use elsewhere).</p>
<p>– Ideally one would have a <code>csv</code> or <code>data.frame</code> of the questions, and display them as loop-switched questions. In this case, the questionnaire is in a <code>docx</code> and so <code>library(docxtrackr)</code> may help.</p>
<p>– Rather than a nested loop, one would likely prefer to pick a question, loop over the demographic and ideological categories for the crosstabs, and then insert commentary and overview.</p>
<p>– The outer loops makes a new page each time it is run, with the inner loop with <code>cat(&quot;\\newpage&quot;))</code>, which is specific to rendering as <code>PDF</code>. Extra line breaks <code>\n</code> are needed to break out of the table formatting and keep code and text separate. A different approach to page breaks is needed <a rel="nofollow" href="https://stackoverflow.com/questions/24672111/how-to-add-a-page-break-in-word-document-generated-by-rstudio-markdown" target="_blank">for docx</a>.</p>
</div>
</div>
<div>
<h1>Adapting the Template with Parameters</h1>
<p>The next step is to add a <a rel="nofollow" href="http://rmarkdown.rstudio.com/developer_parameterized_reports.html" target="_blank">parameter</a> with any variables you need. The parameters will be controlled by the R script discussed below. There is, of course, quite a bit of choice as to what is controlled by which file, but often only a handful of parameters are necessary. Add the following to the end of the header of <code>pewpoliticaltemplate.Rmd</code>:</p>
<pre><code>params:
  spssfile: !r  1
  surveywave: !r 2016</code></pre>
<div>
<img src="https://i2.wp.com/rviews.rstudio.com/post/2017-11-01-Mohanty-Surveys_files/images/newheader.png?w=456&ssl=1" data-recalc-dims="1">
</div>
<p>That creates variables <code>params$spssfile</code> and <code>params$surveywave</code> that can be controlled externally from other R sessions, and gives them default values of <code>1</code> and <code>2016</code> respectively. Setting default values smooths debugging by allowing you to continue knitting the <code>Rmd</code> on its own (rather than from the R script we will create in a moment… You can also click on Knit and choose <code>Knit with Parameters</code> to specify particular values).</p>
<p>Now make any changes to <code>Rmd</code> template. For example, in the <code>ggplot</code> code…</p>
<pre><code>PA &lt;- PA + ggtitle(paste(&quot;Presidential Approval:&quot;, params$surveywave))</code></pre>
<p>Notice we can get a list of all the <code>spss</code> files like so:</p>
<pre><code>dir(pattern = &quot;sav&quot;, recursive = TRUE)</code></pre>
<pre><code>[1] &quot;http___www.people-press.org_files_datasets_Aug16/Aug16 public.sav&quot;
[2] &quot;Jan16/Jan16 public.sav&quot;                                           
[3] &quot;March16/March16 public.sav&quot;                                       
[4] &quot;Oct16/Oct16 public.sav&quot;                                           </code></pre>
<p>or in this case</p>
<pre><code>dir(pattern = &quot;16 public.sav&quot;, recursive = TRUE)</code></pre>
<pre><code>[1] &quot;http___www.people-press.org_files_datasets_Aug16/Aug16 public.sav&quot;
[2] &quot;Jan16/Jan16 public.sav&quot;                                           
[3] &quot;March16/March16 public.sav&quot;                                       
[4] &quot;Oct16/Oct16 public.sav&quot;                                           </code></pre>
<p>I recommend making the pattern as specific as possible in case you or your collaborators add other <code>spss</code> files with similar names. To use regular expressions to specify more complicated patterns, see <a rel="nofollow" href="https://rstudio-pubs-static.s3.amazonaws.com/74603_76cd14d5983f47408fdf0b323550b846.html" target="_blank">here</a>.</p>
<p>Now back to editing <code>pewpoliticaltemplate.Rmd</code>…</p>
<div>
<img src="https://i0.wp.com/rviews.rstudio.com/post/2017-11-01-Mohanty-Surveys_files/images/newreadingdata.png?w=456&ssl=1" data-recalc-dims="1">
</div>
<p>Knit the file to see how it looks with these default settings; that’s it for this portion.</p>
</div>
<div>
<h1>Automating with knitr</h1>
<p>Now create a new R script; mine’s called <code>pew_report_generator.R</code>. It’s just a simple loop that tells which data set to grab, as well as the label to pass to the <code>Rmd</code>. Note that the labels appear in alphabetical rather than chronological order as a function of the way that the <code>Rmd</code> happens to find the files.</p>
<pre><code>library(pacman)
p_load(knitr, rmarkdown, sessioninfo)

setwd(&quot;/users/mohanty/Desktop/pewpolitical/&quot;)

waves &lt;- c(&quot;August 2016&quot;, &quot;January 2016&quot;, &quot;March 2016&quot;, &quot;October 2016&quot;)

for (i in 1:length(waves)) {
    render(&quot;pewpoliticaltemplate.Rmd&quot;, params = list(spssfile = i, surveywave = waves[i]), 
        output_file = paste0(&quot;Survey Analysis &quot;, waves[i], &quot;.pdf&quot;))
}

session &lt;- session_info()
save(session, file = paste0(&quot;session&quot;, format(Sys.time(), &quot;%m%d%Y&quot;), &quot;.Rdata&quot;))</code></pre>
<p>That’s it. Of course, in practice you might write some code on the first survey that doesn’t work for all of them. Pew, for example, seems to have formatted the survey date differently in the last two surveys, which led me to make a few changes. But if the data are formatted fairly consistently, a one-time investment can save massive amounts of time lost to error-prone copying and pasting.</p>
<div>
<h3>A Little Version Control</h3>
<p>The last bit of code is not necessary, but is a convenient way to store which versions of which libraries were actually used on which version of R. If something works now but not in the future, <code>install_version</code> (found in <code>library(devtools)</code>) can be used to install the older version of particular packages.</p>
<pre><code>s &lt;- session_info()
s$platform</code></pre>
<pre><code> setting  value                       
 version  R version 3.4.2 (2017-09-28)
 os       macOS Sierra 10.12.6        
 system   x86_64, darwin15.6.0        
 ui       X11                         
 language (EN)                        
 collate  en_US.UTF-8                 
 tz       America/Los_Angeles         
 date     2017-11-06                  </code></pre>
<pre><code>s$packages</code></pre>
<pre><code> package     * version date       source                          
 assertthat    0.2.0   2017-04-11 CRAN (R 3.4.0)                  
 backports     1.1.1   2017-09-25 CRAN (R 3.4.2)                  
 bindr         0.1     2016-11-13 CRAN (R 3.4.0)                  
 bindrcpp      0.2     2017-06-17 CRAN (R 3.4.0)                  
 broom         0.4.2   2017-02-13 CRAN (R 3.4.0)                  
 cellranger    1.1.0   2016-07-27 CRAN (R 3.4.0)                  
 clisymbols    1.2.0   2017-05-21 cran (@1.2.0)                   
 colorspace    1.3-2   2016-12-14 CRAN (R 3.4.0)                  
 digest        0.6.12  2017-01-27 CRAN (R 3.4.0)                  
 dplyr       * 0.7.4   2017-09-28 cran (@0.7.4)                   
 evaluate      0.10.1  2017-06-24 CRAN (R 3.4.1)                  
 forcats       0.2.0   2017-01-23 CRAN (R 3.4.0)                  
 foreign     * 0.8-69  2017-06-22 CRAN (R 3.4.2)                  
 formatR       1.5     2017-04-25 CRAN (R 3.4.0)                  
 ggplot2     * 2.2.1   2016-12-30 CRAN (R 3.4.0)                  
 glue          1.2.0   2017-10-29 CRAN (R 3.4.2)                  
 gtable        0.2.0   2016-02-26 CRAN (R 3.4.0)                  
 haven         1.1.0   2017-07-09 CRAN (R 3.4.1)                  
 highr         0.6     2016-05-09 CRAN (R 3.4.0)                  
 hms           0.3     2016-11-22 CRAN (R 3.4.0)                  
 htmltools     0.3.6   2017-04-28 CRAN (R 3.4.0)                  
 httpuv        1.3.5   2017-07-04 CRAN (R 3.4.1)                  
 httr          1.3.1   2017-08-20 cran (@1.3.1)                   
 jsonlite      1.5     2017-06-01 CRAN (R 3.4.0)                  
 knitr       * 1.17    2017-08-10 CRAN (R 3.4.1)                  
 labeling      0.3     2014-08-23 CRAN (R 3.4.0)                  
 lattice       0.20-35 2017-03-25 CRAN (R 3.4.2)                  
 lazyeval      0.2.1   2017-10-29 CRAN (R 3.4.2)                  
 lubridate     1.7.0   2017-10-29 CRAN (R 3.4.2)                  
 magrittr      1.5     2014-11-22 CRAN (R 3.4.0)                  
 mime          0.5     2016-07-07 CRAN (R 3.4.0)                  
 miniUI        0.1.1   2016-01-15 CRAN (R 3.4.0)                  
 mnormt        1.5-5   2016-10-15 CRAN (R 3.4.0)                  
 modelr        0.1.1   2017-07-24 CRAN (R 3.4.1)                  
 munsell       0.4.3   2016-02-13 CRAN (R 3.4.0)                  
 nlme          3.1-131 2017-02-06 CRAN (R 3.4.2)                  
 pacman      * 0.4.6   2017-05-14 CRAN (R 3.4.0)                  
 pkgconfig     2.0.1   2017-03-21 CRAN (R 3.4.0)                  
 plyr          1.8.4   2016-06-08 CRAN (R 3.4.0)                  
 psych         1.7.8   2017-09-09 CRAN (R 3.4.1)                  
 purrr       * 0.2.4   2017-10-18 CRAN (R 3.4.2)                  
 questionr   * 0.6.3   2017-11-06 local                           
 R6            2.2.2   2017-06-17 CRAN (R 3.4.0)                  
 Rcpp          0.12.13 2017-09-28 cran (@0.12.13)                 
 readr       * 1.1.1   2017-05-16 CRAN (R 3.4.0)                  
 readxl        1.0.0   2017-04-18 CRAN (R 3.4.0)                  
 reshape2      1.4.2   2016-10-22 CRAN (R 3.4.0)                  
 rlang         0.1.2   2017-08-09 CRAN (R 3.4.1)                  
 rmarkdown     1.6     2017-06-15 CRAN (R 3.4.0)                  
 rprojroot     1.2     2017-01-16 CRAN (R 3.4.0)                  
 rstudioapi    0.7     2017-09-07 cran (@0.7)                     
 rvest         0.3.2   2016-06-17 CRAN (R 3.4.0)                  
 scales        0.5.0   2017-08-24 cran (@0.5.0)                   
 sessioninfo * 1.0.0   2017-06-21 CRAN (R 3.4.1)                  
 shiny         1.0.5   2017-08-23 cran (@1.0.5)                   
 stringi       1.1.5   2017-04-07 CRAN (R 3.4.0)                  
 stringr       1.2.0   2017-02-18 CRAN (R 3.4.0)                  
 tibble      * 1.3.4   2017-08-22 cran (@1.3.4)                   
 tidyr       * 0.7.2   2017-10-16 CRAN (R 3.4.2)                  
 tidyverse   * 1.1.1   2017-01-27 CRAN (R 3.4.0)                  
 withr         2.0.0   2017-10-25 Github (jimhester/withr@a43df66)
 xml2          1.1.1   2017-01-24 CRAN (R 3.4.0)                  
 xtable        1.8-2   2016-02-05 CRAN (R 3.4.0)                  
 yaml          2.1.14  2016-11-12 CRAN (R 3.4.0)</code></pre>
</div>
</div>
<p> </p>
	<p>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="https://rviews.rstudio.com/2017/11/07/automating-summary-of-surveys-with-rmarkdown/"> R Views</a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="https://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a rel="nofollow" href="https://www.r-project.org/" title="The R Project for Statistical Computing">R</a> news and <a rel="nofollow" href="https://www.r-bloggers.com/search/tutorial" title="R tutorials">tutorials</a> on topics such as: <a rel="nofollow" href="https://www.r-bloggers.com/search/data%20science" title="Data science">Data science</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Big%20Data" title="Big Data">Big Data, <a rel="nofollow" href="https://www.r-users.com/" title="R jobs">R jobs</a>, visualization (<a rel="nofollow" href="https://www.r-bloggers.com/search/ggplot2" title="ggplot and ggplot2 tutorials">ggplot2</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/boxplot" title="Boxplots using lattice and ggplot2 tutorials">Boxplots</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/map" title="Maps and gis">maps</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/animation" title="Animation in R">animation</a>), programming (<a rel="nofollow" href="https://www.r-bloggers.com/search/RStudio" title="RStudio IDE for R">RStudio</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/sweave" title="Sweave and literate programming">Sweave</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/LaTeX" title="LaTeX in R">LaTeX</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/SQL" title="SQL and databases">SQL</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/eclipse" title="Eclipse IDE for R">Eclipse</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/git" title="git and github, Version Control System">git</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/hadoop" title="Large data in R using Hadoop">hadoop</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Web+Scraping" title="Web Scraping of google, facebook, yahoo, twitter and more using R">Web Scraping</a>) statistics (<a rel="nofollow" href="https://www.r-bloggers.com/search/regression" title="Regressions and ANOVA analysis tutorials">regression</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/PCA" title="principal component analysis tutorial">PCA</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/time+series" title="Time series">time series</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/trading" title="finance trading">trading</a>) and more...
<img width="1" alt="" src="http://feeds.feedburner.com/~r/RBloggers/~4/N4KfESc8qf0" height="1"></a></div>