Skip to Content
Data Science with SQL Server Quick Start Guide
book

Data Science with SQL Server Quick Start Guide

by Dejan Sarka
August 2018
Beginner to intermediate content levelBeginner to intermediate
206 pages
4h 34m
English
Packt Publishing
Content preview from Data Science with SQL Server Quick Start Guide

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 <- as.data.frame(sqlQuery(con, "SELECT c.CustomerKey, g.EnglishCountryRegionName AS Country, c.EnglishEducation AS Education, c.YearlyIncome ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Hands-On Data Science with SQL Server 2017

Hands-On Data Science with SQL Server 2017

Marek Chmel, Vladimír Mužný
Introducing Microsoft SQL Server 2019

Introducing Microsoft SQL Server 2019

Kellyn Gorman, Allan Hirt, Dave Noderer, Mitchell Pearson, James Rowland-Jones, Dustin Ryan, Arun Sirpal, Buck Woody

Publisher Resources

ISBN: 9781789537123Supplemental Content