<p><div><div><div><div data-width="100" data-show-faces="false" data-send="true" data-layout="button_count" data-height="21" data-href="https://www.r-bloggers.com/making-a-team-survey-to-get-my-colleagues-hooked-on-r/"></div></div><div><a data-url="https://www.r-bloggers.com/making-a-team-survey-to-get-my-colleagues-hooked-on-r/" data-counturl="https://www.r-bloggers.com/making-a-team-survey-to-get-my-colleagues-hooked-on-r/" data-count="horizontal" data-text="Making a team survey to get my colleagues hooked on R" class="twitter-share-button" data-via="rbloggers" href="https://twitter.com/share"></a></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="https://privefl.github.io/blog/Making-a-team-survey-to-get-my-colleagues-hooked-on-R/"> Florian Privé</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<section>
<p>In this post, I will talk about the presentation of R that I did today, in the first week of my PhD. Usually, it is a team-only presentation. Yet, other people came because they were interested in learning more about R.</p>
<div>
<h2>How I get this idea?</h2>
<p>I get the idea of doing an R presentation while reading <a target="_blank" href="https://www.r-bloggers.com/getting-your-colleagues-hooked-on-r/">Getting Your Colleagues Hooked on R</a> on <a target="_blank" href="https://www.r-bloggers.com/">R-bloggers</a>. I began by following the 7 tips of this post to make my presentation, which was a good starting point.</p>
<p>After a while, I feared that a general presentation would not get my team interested in R. So, I decided to set up a <a target="_blank" href="https://goo.gl/forms/LREeX5NORBJlCrcC3">google form</a> and ask them what they wanted to learn about R. It was the way to get sure that they would care.</p>
</div>
<div>
<h2>Get results automatically</h2>
<p>Because I was writing my R Markdown presentation while they were answering the google form, I decided that I should get (and show) the results automatically (only by re-knitting my presentation).</p>
<div>
<h3>To get the results</h3>
<p>I used the <code>gsheet</code> package (one could also use the <code>googlesheets</code> package):</p>
<div>
<pre><code><span>library</span>(pacman)
<span>p_load</span>(magrittr, longurl, gsheet)

responses &lt;-<span> &quot;goo.gl/4zYmrw&quot;</span> %>%<span> </span>expand_urls %>%<span> </span>{<span>gsheet2tbl</span>(.$expanded_url)[, <span>2</span>]}</code></pre>
</div>
</div>
<div>
<h3>To get the different possible choices of the form</h3>
<p>I got them directly from reading the website of the google form:</p>
<div>
<pre><code><span>p_load</span>(gsubfn, stringr)

questions &lt;-<span> </span>
<span> &quot;https://goo.gl/forms/LREeX5NORBJlCrcC3&quot;</span> %>%
<span> </span><span>readLines</span>(<span>encoding =</span> <span>&quot;UTF-8&quot;</span>) %>%
<span> </span><span>strapply</span>(<span>pattern =</span> <span>&quot;</span><span>\\</span><span>[</span><span>\&quot;</span><span>([^</span><span>\&quot;</span><span>]*)</span><span>\&quot;</span><span>,,,,0</span><span>\\</span><span>]&quot;</span>) %>%
<span> </span>unlist</code></pre>
</div>
<p>I couldn’t get them directly from the googlesheet because google doesn’t make the difference between a comma in the name of the choices and commas used to seperate multiple answers. If you know how to specify the separation when generating results from a google form, I’d like to know.</p>
</div>
<div>
<h3>To print the results directly in my presentation</h3>
<p>I used the chunk option <code>results='asis'</code>:</p>
<div>
<pre><code>counts &lt;-<span> </span><span>str_count</span>(responses, <span>coll</span>(questions))
counts.lvl &lt;-<span> </span>counts %>%<span> </span>unique %>%<span> </span><span>sort</span>(<span>decreasing =</span> <span>TRUE</span>) %>%<span> </span><span>setdiff</span>(<span>0</span>)

printf &lt;-<span> </span>function(...) <span>cat</span>(<span>sprintf</span>(...))

for (n in counts.lvl) {
  if (n ==<span> </span><span>2</span>) <span>printf</span>(<span>&quot;</span><span>\n</span><span>***</span><span>\n</span><span>&quot;</span>)
  <span>printf</span>(<span>&quot;- for **%d** of you:</span><span>\n</span><span>&quot;</span>, n)
  q.tmp &lt;-<span> </span>questions[counts ==<span> </span>n]
  for (q in q.tmp) {
    <span>printf</span>(<span>&quot; - %s</span><span>\n</span><span>&quot;</span>, q)
  }
}</code></pre>
</div>
<p>in order to generate markdown from R code.</p>
</div>
<div>
<h3>Getting the number of R packages on CRAN</h3>
<p>I also wanted to show them how many package we have on CRAN, so I used:</p>
<div>
<pre><code>n &lt;-<span> </span><span>readLines</span>(<span>'https://cran.r-project.org/web/packages/'</span>) %>%
<span> </span>gsubfn::<span>strapply</span>(
    <span>paste</span>(<span>&quot;Currently, the CRAN package repository&quot;</span>,
          <span>&quot;features ([0-9]+) available packages.&quot;</span>)) %>%
<span> </span>unlist</code></pre>
</div>
<p>and printed <code>n</code> as inline R code.</p>
</div>
</div>
<div>
<h2>Conclusion</h2>
<p>You can see the presentation <a target="_blank" href="https://privefl.github.io/R-presentation/pResentation.html">there</a> and the corresponding Rmd file <a target="_blank" href="https://privefl.github.io/R-presentation/pResentation.Rmd">there</a>.</p>
<p>After finishing my presentation, I realized that most of what I presented, I learned it on R-bloggers. So, thanks everyone for the wonderful posts we get to read everyday!</p>
<p>If some of you think about other things that are important to know about R, I’d like to hear about them, just as personal curiosity.</p>
</div>
</section>
<p><div><div><div><div data-width="55" data-show-faces="false" data-send="true" data-layout="box_count" data-height="62" data-href="https://www.r-bloggers.com/making-a-team-survey-to-get-my-colleagues-hooked-on-r/"></div></div><div><a data-url="https://www.r-bloggers.com/making-a-team-survey-to-get-my-colleagues-hooked-on-r/" data-counturl="https://www.r-bloggers.com/making-a-team-survey-to-get-my-colleagues-hooked-on-r/" data-count="vertical" data-text="Making a team survey to get my colleagues hooked on R" class="twitter-share-button" data-via="rbloggers" href="https://twitter.com/share"></a></div><div></div></div><div></div></div>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="https://privefl.github.io/blog/Making-a-team-survey-to-get-my-colleagues-hooked-on-R/"> Florian Privé</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 title="The R Project for Statistical Computing" rel="nofollow" href="https://www.r-project.org/">R</a> news and <a title="R tutorials" rel="nofollow" href="https://www.r-bloggers.com/?s=tutorial">tutorials</a> on topics such as: <a title="Data science" rel="nofollow" href="https://www.r-bloggers.com/?s=data%20science">Data science</a>, <a title="Big Data" rel="nofollow" href="https://www.r-bloggers.com/?s=Big%20Data">Big Data, <a title="R jobs" rel="nofollow" href="https://www.r-users.com/">R jobs</a>, visualization (<a title="ggplot and ggplot2 tutorials" rel="nofollow" href="https://www.r-bloggers.com/?s=ggplot2">ggplot2</a>, <a title="Boxplots using lattice and ggplot2 tutorials" rel="nofollow" href="https://www.r-bloggers.com/?s=boxplot">Boxplots</a>, <a title="Maps and gis" rel="nofollow" href="https://www.r-bloggers.com/?s=map">maps</a>, <a title="Animation in R" rel="nofollow" href="https://www.r-bloggers.com/?s=animation">animation</a>), programming (<a title="RStudio IDE for R" rel="nofollow" href="https://www.r-bloggers.com/?s=RStudio">RStudio</a>, <a title="Sweave and literate programming" rel="nofollow" href="https://www.r-bloggers.com/?s=sweave">Sweave</a>, <a title="LaTeX in R" rel="nofollow" href="https://www.r-bloggers.com/?s=LaTeX">LaTeX</a>, <a title="SQL and databases" rel="nofollow" href="https://www.r-bloggers.com/?s=SQL">SQL</a>, <a title="Eclipse IDE for R" rel="nofollow" href="https://www.r-bloggers.com/?s=eclipse">Eclipse</a>, <a title="git and github, Version Control System" rel="nofollow" href="https://www.r-bloggers.com/?s=git">git</a>, <a title="Large data in R using Hadoop" rel="nofollow" href="https://www.r-bloggers.com/?s=hadoop">hadoop</a>, <a title="Web Scraping of google, facebook, yahoo, twitter and more using R" rel="nofollow" href="https://www.r-bloggers.com/?s=Web+Scraping">Web Scraping</a>) statistics (<a title="Regressions and ANOVA analysis tutorials" rel="nofollow" href="https://www.r-bloggers.com/?s=regression">regression</a>, <a title="principal component analysis tutorial" rel="nofollow" href="https://www.r-bloggers.com/?s=PCA">PCA</a>, <a title="Time series" rel="nofollow" href="https://www.r-bloggers.com/?s=time+series">time series</a>, <a title="finance trading" rel="nofollow" href="https://www.r-bloggers.com/?s=trading">trading</a>) and more...
<img height="1" alt="" width="1" src="http://feeds.feedburner.com/~r/RBloggers/~4/e3coVOg4iFc"></a></div>