CoolFace
Apppublic

sudvoleti/segmentation-app

sourceHugging Faceapache-2.0updated 1y agoView on Hugging Face
0likes
ui.R85 linesDownload Raw Back to root
1####################################################
2#      Marketing -Segmentation                     #
3####################################################
4library('dplyr')
5library("shiny")
6library('DT')
7library('dendextend')
8library('ggbiplot')
9#library("foreign")
10
11shinyUI(fluidPage(
12  # Header:
13  #headerPanel("Segmentation Analysis"),
14  title = "Segmentation Analysis",
15  # titlePanel("Regression Tree"),
16
17  titlePanel(title=div(img(src="logo.png",align='right'),"Segmentation Analysis")),
18  
19  
20  # Input in sidepanel:
21  sidebarPanel(
22
23    fileInput("file", "Upload Segmentation data (csv file with header)"),
24    uiOutput("colList"),  
25    selectInput("select", "Choose Segmentation Algo", 
26                       c("K-Means","Hierarchical"), selected = "K-Means"),
27
28    checkboxInput("scale","scale data (for display)",value=TRUE),
29    
30    numericInput("Clust", "Number of Segments:", value = 3,min = 1),
31    actionButton("chnages", "Apply Changes", icon("refresh")),
32    br(),
33
34  ),
35  # Main:
36  mainPanel( 
37    
38    tabsetPanel(type = "tabs",
39                tabPanel("Overview & Example Dataset",
40                         h4(p("Segmentation")), 
41                         p("Market segmentation is a marketing strategy which involves dividing a broad target market into subsets of consumers, businesses, or countries who have, or are perceived to have, common needs, interests, and priorities, and then designing and implementing strategies to target them. Market segmentation strategies are generally used to identify and further define the target customers, and provide supporting data for marketing plan elements such as positioning to achieve certain marketing plan objectives. Businesses may develop product differentiation strategies, or an undifferentiated approach, involving specific products or product lines depending on the specific demand and attributes of the target segment.",
42                           align="justify"),
43                         a(href="https://en.wikipedia.org/wiki/Market_segmentation","- Wikipedia"),
44                         hr(),
45                         h4(p("Data input")),
46                         p("This shiny application requires input data from the user. To do so, click on the Browse (in left side-bar panel) and upload the Segmentation data input file.
47                            Note that this application can read only csv file(comma delimited file), so if you don't have csv input data file, first convert your data in csv format 
48                            and then proceed. Make sure you have top row as variable names and first column as respondent id/name in csv file"
49                           ,align="justify"),
50                         img(src = "Segmentation.png", height = 180, width = 400),p('Segmentation Sample file'),
51                         br(),
52                         
53                         p("Once csv file is uploaded successfully, by-default application will perform K-means segmentation with 3 segments. In left-side bar panel you can change the segmentation algorithm and number of segments. Click on Apply changes after making any change in the inputs. Accordingly results will be updates in all the tabs",
54                           align="justify"),
55                         hr(),
56                         h4(p("Download Sample files")), br(),
57                         downloadButton('downloadData1', 'Download Segmentation Sample file'), br(),br(),
58                         
59                         p("Please note that download will not work with RStudio interface. Download will work only in web-browsers. So open this app in a web-browser and then download the example file. For opening this app in web-browser click on \"Open in Browser\" as shown below -",
60                           align="justify"),
61                         img(src = "example1.png")
62                         ),
63                    
64                  
65                tabPanel("Data",h4("Uploaded Data"),DT::dataTableOutput('up_data') ),
66                
67                
68                tabPanel("Summary - Segmentation",h3(textOutput("caption1")), h4(div(textOutput("caption2"),style = "color:Red")),
69                           plotOutput("plotpca",height = 400, width = 500),tableOutput('seg_count'),dataTableOutput("summary")),
70                          
71                tabPanel("Simplified Tables", h3(textOutput("Basis Variable Ranges")), dataTableOutput("table1"),
72                        h3(textOutput("Segment Extrema")), tableOutput("table2")),
73                
74                tabPanel("Plot",h3("Segments Plot"), plotOutput("plot",height = 700, width = 840)),
75                
76                tabPanel("Data Segment",br(),
77                         downloadButton('downloadData4', 'Download Segmentation file (Works only in browser)'), br(),br(),
78                         dataTableOutput("table"),tags$head(tags$style("tfoot {display: table-header-group;}")))
79                
80                
81                )
82      ) 
83    ) 
84  )
85