Using the dplyr package in R

One of the most popular packages for data preparation in R is the dplyr package. The package brings a very consistent, simple, readable, and efficient syntax. You work on data with functions that are somewhat mimicking SQL expressions. Let me start this quick introduction with a projection on a dataset. You do this with the select() function of the dplyr package. But before that, I am reading slightly different data from SQL Server than I did before, because I want to have the country of the customer also in my data frame:

con <- odbcConnect("AWDW", uid = "RUser", pwd = "Pa$$w0rd")TM <-, "SELECT c.CustomerKey, g.EnglishCountryRegionName AS Country, c.EnglishEducation AS Education, c.YearlyIncome ...

Get Data Science with SQL Server Quick Start Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.