<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/styler-1-1-0-2/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="https://lorenzwalthert.netlify.com/posts/styler-v1.1/"> Lorenz Walthert</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p><a rel="nofollow" href="https://github.com/r-lib/styler" target="_blank">styler</a> 1.1.0 is now available on CRAN. This<br>
release introduces new features and is fully backward-compatible. It also<br>
adapts to changes in the R parser committed into R devel (<a rel="nofollow" href="https://github.com/r-lib/styler/issues/419" target="_blank">#419</a>). Major changes<br>
are:</p>
<ul>
<li>styler can now style roxygen code examples in the source code of package.<br>
This might be helpful for package developers. The option is enabled by<br>
default, so you have to explicitly turn it off if you want styler to leave<br>
the code examples as is:</li>
</ul>
<pre><code>styler::style_pkg(include_roxygen_examples = FALSE)</code></pre>
<ul>
<li>In addition to R and Rmd files, styler can now handle Rnw files too. The API<br>
ignores capitalization and dot-prefixing for file types:</li>
</ul>
<pre><code>styler::style_dir(filetype = c(&quot;r&quot;, &quot;Rmd&quot;, &quot;.rnw&quot;))</code></pre>
<ul>
<li>the print method for the output of <code>style_text()</code> (<code>print.vertical()</code>) now<br>
returns syntax-highlighted code by default, controllable via the option<br>
<code>styler.colored_print.vertical</code> using the <a rel="nofollow" href="https://cran.r-project.org/package=prettycode" target="_blank">prettycode</a> package. This only<br>
works when ran in a console though, so you can c/p this snippet into yours<br>
to see how it works:</li>
</ul>
<pre><code>styler::style_text(c(
  &quot;add &lt;- function(...) {&quot;, 
  &quot;purrr::reduce(list(...), `+`)&quot;, 
  &quot;}&quot;
))</code></pre>
<p>There were also quite a few minor changes, the most visible ones to the user<br>
were a complete re-design of the README and the fact that the cursor position is<br>
now remembered for styling via Addin. For details, you can have a look at the <a rel="nofollow" href="https://github.com/r-lib/styler/releases/tag/v1.1.0" target="_blank">release notes</a> or check the<br>
full <a rel="nofollow" href="https://github.com/r-lib/styler" target="_blank">commit history</a>.</p>
<p>Thanks to all contributors for patches, issues and the like:<br>
<span>@jonmcalder</span>, <span>@krlmlr</span>, <span>@IndrajeetPatil</span>, <span>@kalibera</span>, <span>@Hasnep</span>, <span>@kiranmaiganji</span>,<br>
<span>@dirkschumacher</span>, <span>@ClaytonJY</span>, <span>@wlandau</span>, <span>@maurolepore</span>.</p>
<p>Although not directly related to this release, we would like to highlight that<br>
the functionality of styler is also available in other packages:</p>
<ul>
<li><code>usethis::use_tidy_style()</code> styles your project according to the<br>
tidyverse style guide.</li>
<li><code>reprex::reprex(..., style = TRUE)</code> to prettify reprex code before<br>
printing. To permanently use <code>style = TRUE</code> without specifying it<br>
every time, you can add the following line to your <code>.Rprofile</code> (via<br>
<code>usethis::edit_r_profile()</code>): <code>options(reprex.styler = TRUE)</code>.</li>
<li>you can pretty-print your R code in RMarkdown reports without having<br>
styler modifying the source. This feature is implemented as a code<br>
chunk option in knitr. use <code>tidy = &quot;styler&quot;</code> in the header of a code<br>
chunks (e.g. <code>```{r name-of-the-chunk, tidy = &quot;styler&quot;}</code>), or<br>
<code>knitr::opts_chunk$set(tidy = &quot;styler&quot;)</code> at the top of your<br>
RMarkdown script. This feature requires the devel version of knitr.</li>
<li>pretty-printing of <a rel="nofollow" href="https://github.com/ropensci/drake" target="_blank">drake</a><br>
workflow data frames with <code>drake::drake_plan_source()</code>.</li>
</ul>
<p>For a complete walk-through we recommend to have a look at the <a rel="nofollow" href="https://lorenzwalthert.netlify.com/posts/stylerpost/" target="_blank">initial blog post</a> that introduces<br>
styler.</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://lorenzwalthert.netlify.com/posts/styler-v1.1/"> Lorenz Walthert</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/cNZ4Z0XWM-o" height="1"></a></div>