## This script is what you copy/paste into the window
# libs needed
library(readr)
library(lubridate)

# import data
# df_sales <- 
#   read_csv('../data/customer_sales1.csv')
# need to specify full path for PowerBI:
df_sales <- 
   read_csv('C:/Users/evancarey/Dropbox/Work/BHAnalytics/courseware/PowerBI/PowerBI_R/PredAnalyticsWebinar/data/customer_sales1.csv')
# clean activity
df_sales$activity[df_sales$activity=='Med'] <- 
  'Medium'
# add transaction year
df_sales$transaction_year <- 
  year(df_sales$transaction_Date)
# add income cat
df_sales$income_cat <- 
  cut(df_sales$income,
      breaks = c(0,60,70,105),
      labels = c('low','medium','high'))

# Create another dataframe to show it is available
df1 <- 
  data.frame(age=c(56,24,35,42),
             gender=c('M','M','F','M'),
             salary=c('35k','35k','50k','25k'))
