Profiling dataframes in R
We will revisit the same dataset from Chapter 4, Creating Bar Charts with D3.js; however, this time it will be retrieved using a SQL statement as opposed to a CSV file. The following SQL statement will return the same data for discount codes by week:
SELECT [WeekInYear] ,[DiscountCode] FROM [AdventureWorks2014].[dbo].[DiscountCodebyWeek]
We can incorporate this same SQL statement inside of a dataframe within R by using the following script:
SQL_Query_1<-sqlQuery(connection_SQLBI, 'SELECT [WeekInYear] ,[DiscountCode] FROM [AdventureWorks2014].[dbo].[DiscountCodebyWeek]' )
A dataframe is merely a dataset organized by columns, and the simplest way to get the results of a dataframe is to execute the following script, which will return the first six rows of the dataset:
head(SQL_Query_1)
In addition to retrieving the first few rows of the dataset, we can identify the structure of the...