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/mmartinez-mendoza/Documents"
setwd("C:/Users/mmartinez-mendoza/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 ...
summary(lm(CS_helpful ~. -ID, data = mydata))
##
## Call:
## lm(formula = CS_helpful ~ . - ID, data = mydata)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.39668 -0.14511 0.02472 0.14090 0.31831
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -0.15348 0.63083 -0.243 0.813901
## Recommend 0.16584 0.13359 1.241 0.249616
## Come_again -0.08160 0.15428 -0.529 0.611218
## All_Products 0.25910 0.08930 2.901 0.019850 *
## Profesionalism 0.55105 0.17158 3.212 0.012395 *
## Limitation 0.58813 0.10853 5.419 0.000632 ***
## Online_grocery 0.23562 0.10777 2.186 0.060268 .
## delivery 0.12848 0.12554 1.023 0.336046
## Pick_up -0.18384 0.09434 -1.949 0.087156 .
## Find_items -0.21428 0.14441 -1.484 0.176143
## other_shops -0.11142 0.06080 -1.832 0.104245
## Gender -0.43572 0.21782 -2.000 0.080474 .
## Age 0.05329 0.12382 0.430 0.678304
## Education 0.02337 0.05384 0.434 0.675679
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.3025 on 8 degrees of freedom
## Multiple R-squared: 0.9353, Adjusted R-squared: 0.8302
## F-statistic: 8.896 on 13 and 8 DF, p-value: 0.002149
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.