R Markdown

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.

When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

getwd()
## [1] "C:/Users/elozano7/Documents/elia"
setwd("C:/Users/elozano7/Documents")
mydata <-read.csv("customer_segmentation.csv")
str(mydata)
## 'data.frame':    22 obs. of  15 variables:
##  $ ID            : int  1 2 3 4 5 6 7 8 9 10 ...
##  $ CS_helpful    : int  2 1 2 3 2 1 2 1 1 1 ...
##  $ Recommend     : int  2 2 1 3 1 1 1 1 1 1 ...
##  $ Come_again    : int  2 1 1 2 3 3 1 1 1 1 ...
##  $ All_Products  : int  2 1 1 4 5 2 2 2 2 1 ...
##  $ Profesionalism: int  2 1 1 1 2 1 2 1 2 1 ...
##  $ Limitation    : int  2 1 2 2 1 1 1 2 1 1 ...
##  $ Online_grocery: int  2 2 3 3 2 1 2 1 2 3 ...
##  $ delivery      : int  3 3 3 3 3 2 2 1 1 2 ...
##  $ Pick_up       : int  4 3 2 2 1 1 2 2 3 2 ...
##  $ Find_items    : int  1 1 1 2 2 1 1 2 1 1 ...
##  $ other_shops   : int  2 2 3 2 3 4 1 4 1 1 ...
##  $ Gender        : int  1 1 1 1 2 1 1 1 2 2 ...
##  $ Age           : int  2 2 2 3 4 2 2 2 2 2 ...
##  $ Education     : int  2 2 2 5 2 5 3 2 1 2 ...
# it looks like the following is one of the best rregression equation for this project
summary(lm(CS_helpful ~Recommend + factor(Gender), data=mydata))
## 
## Call:
## lm(formula = CS_helpful ~ Recommend + factor(Gender), data = mydata)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -0.9430 -0.3896 -0.3896  0.5873  1.5178 
## 
## Coefficients:
##                 Estimate Std. Error t value Pr(>|t|)  
## (Intercept)      0.83610    0.34202   2.445   0.0244 *
## Recommend        0.55344    0.22696   2.438   0.0247 *
## factor(Gender)2  0.09264    0.32181   0.288   0.7766  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.6722 on 19 degrees of freedom
## Multiple R-squared:  0.2415, Adjusted R-squared:  0.1617 
## F-statistic: 3.025 on 2 and 19 DF,  p-value: 0.07233
## the following regression equation does not generate any significant results
summary(lm(Come_again ~Online_grocery + All_Products + factor(Gender) + Education + Age, 
data=mydata))
## 
## Call:
## lm(formula = Come_again ~ Online_grocery + All_Products + factor(Gender) + 
##     Education + Age, data = mydata)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -0.9635 -0.3383 -0.1662  0.1812  1.4269 
## 
## Coefficients:
##                 Estimate Std. Error t value Pr(>|t|)
## (Intercept)      0.99884    0.79708   1.253    0.228
## Online_grocery  -0.08464    0.21264  -0.398    0.696
## All_Products     0.22544    0.16049   1.405    0.179
## factor(Gender)2  0.54431    0.38325   1.420    0.175
## Education        0.08690    0.11185   0.777    0.449
## Age             -0.10114    0.24950  -0.405    0.691
## 
## Residual standard error: 0.7355 on 16 degrees of freedom
## Multiple R-squared:  0.2443, Adjusted R-squared:  0.008206 
## F-statistic: 1.035 on 5 and 16 DF,  p-value: 0.4308

Including Plots

You can also embed plots, for example:

Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.