Data Mining course taught me to comb through the complex business data sets to produce knowledge and business intelligence. During this course we learned the basics of business analytics. We dealt with actual business scenarios like sales, marketing, logistics, and finance. We also had a chance to bring in practical problems from our own fields of interest. By learning basics of business analytics, we explored different features and libraries of R Studio.

Pivot Tables are probably the most powerful feature of Microsoft Excel. Pivot tables allow cross tabulation of different variables and display values as either sums, counts, averages, etc. Moreover, user has the ability to add and remove variables and modify results accordingly. This functionality proves to be extremely useful and can actually work as a basic dashboard. One of the amazing library I found is rpivotTable which became one of my favorite package so far and I have decided to include into my last Individual Blog for the future reference and use.

Biggest advantage of rpivotTable() is that it can show output not just as a simple table. Different output formats available are:

Barcharts
Heatmaps
Treemaps
Stacked Bar Chart
Area Chart
Line Chart
Scatter Chart
library(htmlwidgets)
library(rpivotTable)
medicaid <-read.csv('https://raw.githubusercontent.com/uplotnik/Health/main/Medicaid_Program_Enrollment_by_Month___Beginning_2009-5.csv')
head(medicaid)
##   Eligibility.Year Eligibility.Month Economic.Region Aid.Category Dual.Eligible
## 1             2013                 1     Long Island          SSI            NO
## 2             2013                 1     Long Island          SSI            NO
## 3             2013                 1     Long Island          SSI            NO
## 4             2013                 1     Long Island          SSI            NO
## 5             2013                 1     Long Island          SSI            NO
## 6             2013                 1     Long Island          SSI            NO
##   Managed.Care.vs..Fee.For.Service   Plan.Name Plan.Type Gender Age.Group
## 1                              MMC HEALTHFIRST  HMO/PHSP Female     00-20
## 2                              MMC HEALTHFIRST  HMO/PHSP Female     00-20
## 3                              MMC HEALTHFIRST  HMO/PHSP Female     00-20
## 4                              MMC HEALTHFIRST  HMO/PHSP Female     00-20
## 5                              MMC HEALTHFIRST  HMO/PHSP Female     00-20
## 6                              MMC HEALTHFIRST  HMO/PHSP Female     00-20
##              Race Number.of.Recipients
## 1           ASIAN                    6
## 2           BLACK                  133
## 3        HISPANIC                  144
## 4 NATIVE AMERICAN                    1
## 5           OTHER                   72
## 6           WHITE                   81
rpivotTable(medicaid, cols="Eligibility.Year",
       rows=c("Economic.Region","Aid.Category"),
       aggregatorName="Sum",
       vals="Number.of.Recipients",
       renderName="Table",height="400px")
rpivotTable(medicaid, cols="Eligibility.Year",
       rows=c("Plan.Type","Gender"),
       aggregatorName="Sum as Fraction of Columns",
       vals="Age.Group",
       renderName="Table Barchart",
       height="400px")
rpivotTable(medicaid, rows="Aid.Category",
       cols=c("Aid.Category","Gender"),
       aggregatorName="Sum as Fraction of Columns",
       vals="Age.Group",
       renderName="Heatmap",
       height="400px")
rpivotTable(medicaid, rows="Aid.Category",
       cols=c("Aid.Category","Economic.Region"),
       aggregatorName="Average",
       vals="Number.of.Recipients",
       renderName="Barchart",
       height="400px")