Skip to content

Commit 0bf35ec

Browse files
author
Ahmed Hussnain
committed
Merge branch 'Mustufain-master'
2 parents 8cda3d4 + 01085a8 commit 0bf35ec

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

r-shiny-app/server.R

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
library(shiny)
22
library(ggplot2)
3+
library(dplyr)
4+
35

46
freqfunc <- function(x, n){
57
tail(sort(table(unlist(strsplit(as.character(x), ";")))), n)
@@ -27,4 +29,33 @@ function(input, output, session) {
2729
theme(legend.position="none")
2830
})
2931

32+
genderData <- reactive({
33+
subset(so_data, Country == 'Pakistan', select=c("Country","Gender"))
34+
35+
})
36+
37+
output$plot2<-renderPlot({
38+
39+
40+
feature_data = genderData()
41+
colnames(feature_data) = c("Country","Gender")
42+
43+
sel_df <- so_data %>%
44+
filter(Country=='Pakistan') %>%
45+
count(Gender) %>%
46+
na.omit()
47+
48+
#sel_df = as.data.frame(freqfunc(feature_data$question, 10))
49+
50+
ggplot(data=sel_df, aes(x=sel_df$Gender, y=sel_df$n , fill = factor(sel_df$Gender))) +
51+
ggtitle("Gender Diversity of Developers in Pakistan") +
52+
geom_bar(stat="identity") +
53+
xlab("Responndants choices") +
54+
ylab("Number of Resonpses") +
55+
theme(legend.position="none")
56+
}
57+
58+
59+
)
60+
3061
}

r-shiny-app/ui.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ fluidPage(
99
width = 4
1010
),
1111
mainPanel(
12-
plotOutput('plot1',width = "100%", height = "300px")
12+
plotOutput('plot1',width = "100%", height = "300px"),
13+
plotOutput('plot2',width = "100%", height = "300px")
1314
)
1415
)

0 commit comments

Comments
 (0)