R Verbs vs SQL Statements

What language to use for data analysis is the most hackneyed and painful topic. Therefore, we teamed up with Alexey Seleznyov, head of analytics at Netpeak and the author of the telegram channel R4Marketing , and prepared a comparison of SQL operators and verbs of the R language. For convenience and portability, we did it in cards.





We publish even more interesting materials on programming and data analysis every day in our Telegram channel and in the VK group . Perhaps you will find something interesting for yourself.





However, to the point!





R vs SQL

The first thing to do before making a comparison is to brush up on basic SQL statements. Of course, you all remember them, but suddenly ...





We will consider the DML (Data Manipulation Language) SELECT statement and everything related to it:





  1. The SELECT statement itself governs which fields to select from the table





  2. The FROM clause points to the table from which the selection is made





  3. The WHERE clause filters the table by the values ​​of a particular column





  4. GROUP BY specifies grouping fields for calculating aggregating characteristics





  5. ORDER BY operator sorts table rows by values ​​in some column





, . R? - dplyr R ( ), .





dplyr ( tidyverse) , , :





  1. , ,





  2. dplyr tidy data





  3. ( %>%)





, SQL dplyr:





, , dplyr . - , :) , (.. dplyr - tidyverse) . :





Tidy data

tidy data. , 100% .





, , Β« Β»:





Data Analysis:





«» , «» -.





tidy datasets dplyr !





, tidy data .





%>%

, R - %>%. , , tidyverse.





- .





, - 2 : R, SQL, - . R - , - .








All Articles