Skip to content

Commit

Permalink
updata
Browse files Browse the repository at this point in the history
  • Loading branch information
dana0102 committed Jan 30, 2016
1 parent 73eb2a7 commit 9783919
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions ESRofCA.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ pusa <- fread("~/desktop/project1/csv_pus/ss13pusa.csv", select = cols)
pusb <- fread("~/desktop/project1/csv_pus/ss13pusb.csv", select = cols)
pus<- rbind(pusa, pusb)

##Select the data
Male <- pus %>%
na.omit()%>%
filter(MSP %in% c(3,4,5,6)) %>%
Expand Down Expand Up @@ -58,8 +59,17 @@ statecode

Malejob1<- mutate(Male, value = Malejob$count/Male$count*100)
Malejob1
Malejob1[5]
# ST count value
#(int) (int) (dbl)
# 1 6 3623480 48.75851
Femalejob1<- mutate(Femalejob, value = Femalejob$count/Female$count*100)
Femalejob1
Femalejob1[5]
# ST count value
#(int) (int) (dbl)
#1 6 1546252 48.80578

# join state code in table
Malejob1 <- left_join(Malejob1 , statecode, by.x=c("ST"))
Femalejob1 <- left_join(Femalejob1 , statecode, by.x=c("ST"))
Expand All @@ -71,10 +81,13 @@ visual <- rbind(Malejob1,Femalejob1)
#plot graph
AllPlot<- ggplot(visual, aes(x=State, y=value, fill=factor(gender))) +
geom_bar(stat="identity",position="dodge") + scale_fill_hue(l=40) +
ylab("Average emplyoment") +
xlab("state") + ggtitle(paste("Average Employment"," by State")) +
ylab("emplyoment ratio") +
xlab("state") + ggtitle(paste("Employment ratio")) +
theme(axis.text.x = element_text(angle = 30, hjust = 1),
panel.background = element_rect(fill = 'white' ))
ggsave(paste("Plot_","_",".png", sep = ""), width = 20, height = 15)
AllPlot
##
##
##
#the employment rate of male in CA is 48.75851%
#the employment rate of female in CA is 48.80578%
Binary file removed ESRofCA.png
Binary file not shown.
Binary file added ESRplotof CA.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 9783919

Please sign in to comment.