<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/announcing-rquery/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="http://www.win-vector.com/blog/2017/12/announcing-rquery/"> R – Win-Vector Blog</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p>We are excited to announce the <a rel="nofollow" href="https://github.com/WinVector/rquery" target="_blank"><code>rquery</code></a> <a rel="nofollow" href="https://www.r-project.org/" target="_blank"><code>R</code></a> package.</p>
<p><a rel="nofollow" href="https://github.com/WinVector/rquery" target="_blank"><code>rquery</code></a> is <a rel="nofollow" href="http://win-vector.com/" target="_blank">Win-Vector LLC</a>‘s currently in development big data query tool for <a rel="nofollow" href="https://www.r-project.org/" target="_blank"><code>R</code></a>.</p>
<p><code>rquery</code> supplies set of operators inspired by <a rel="nofollow" href="https://en.wikipedia.org/wiki/Edgar_F._Codd" target="_blank">Edgar F. Codd</a>‘s <a rel="nofollow" href="https://en.wikipedia.org/wiki/Relational_algebra" target="_blank">relational algebra</a> (updated to reflect lessons learned from working with <a rel="nofollow" href="https://www.r-project.org/" target="_blank"><code>R</code></a>, <a rel="nofollow" href="https://en.wikipedia.org/wiki/SQL" target="_blank"><code>SQL</code></a>, and <a rel="nofollow" href="https://cran.r-project.org/package=dplyr" target="_blank"><code>dplyr</code></a> at big data scale in production).</p>
<p><span></span></p>
<p>As an example: <code>rquery</code> operators allow us to write our earlier <a rel="nofollow" href="http://winvector.github.io/FluidData/partition_mutate_ex2.html" target="_blank">“treatment and control” example</a> as follows.</p>
<pre>
dQ &lt;- d %.>%
  extend_se(.,
            if_else_block(
              testexpr =
                &quot;rand()>=0.5&quot;,
              thenexprs = qae(
                a_1 := 'treatment',
                a_2 := 'control'),
              elseexprs = qae(
                a_1 := 'control',
                a_2 := 'treatment'))) %.>%
  select_columns(., c(&quot;rowNum&quot;, &quot;a_1&quot;, &quot;a_2&quot;))
 </pre>
<p><code>rquery</code> pipelines are first-class objects; so we can extend them, save them, and even print them.</p>
<pre>
cat(format(dQ))

table('d') %.>%
 extend(.,
  ifebtest_1 := rand() >= 0.5) %.>%
 extend(.,
  a_1 := ifelse(ifebtest_1,&quot;treatment&quot;,a_1),
  a_2 := ifelse(ifebtest_1,&quot;control&quot;,a_2)) %.>%
 extend(.,
  a_1 := ifelse(!( ifebtest_1 ),&quot;control&quot;,a_1),
  a_2 := ifelse(!( ifebtest_1 ),&quot;treatment&quot;,a_2)) %.>%
 select_columns(., rowNum, a_1, a_2)
</pre>
<p><code>rquery</code> targets only databases, and right now primarilly <code>SparkSQL</code> and <code>PostgreSQL</code>. <code>rquery</code> is primarily a <code>SQL</code> generator, allowing it to avoid some of the trade-offs required to directly support in-memory <code>data.frame</code>s. We demonstrate converting the above <code>rquery</code> pipeline into <code>SQL</code> and executing it <a rel="nofollow" href="http://winvector.github.io/FluidData/partition_mutate_ex3.html" target="_blank">here</a>.</p>
<p><code>rquery</code> itself is still in early development (and not yet ready for extensive use in production), but it is maturing fast, and we expect more <code>rquery</code> announcements going forward. Our current intent is to bring in sponsors, partners, and <code>R</code> community voices to help develop and steer <code>rquery</code>.</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="http://www.win-vector.com/blog/2017/12/announcing-rquery/"> R – Win-Vector Blog</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/QT_FkRBaVX8" height="1"></a></div>