install.packages(“sas7bdat”)
library(sas7bdat)
setwd("D:\\gd\\2016년 1학기\\계량\\과제1")
labor <- read.sas7bdat("labor.sas7bdat")
labor1 <- subset(labor, year > 2010 & region == 12,
select = c("year", "marketinc", "region"))
summary(labor1)
## year marketinc region
## Min. :2011 Min. : 30 Min. :12
## 1st Qu.:2012 1st Qu.: 960 1st Qu.:12
## Median :2012 Median : 1800 Median :12
## Mean :2012 Mean : 2291 Mean :12
## 3rd Qu.:2013 3rd Qu.: 3178 3rd Qu.:12
## Max. :2014 Max. :13200 Max. :12
## NA's :990
library(ggplot2)
ggplot(labor1, aes(x=factor(year), y=marketinc)) + geom_boxplot()
## Warning: Removed 990 rows containing non-finite values (stat_boxplot).
labor_graph <- ggplot(labor1, aes(x=factor(year), y=marketinc))
labor_graph + geom_boxplot(notch = TRUE) +
stat_summary(fun.y = "mean", geom = "point", shape = 23, size = 4, )
## Warning: Removed 990 rows containing non-finite values (stat_boxplot).
## Warning: Removed 990 rows containing non-finite values (stat_summary).
labor_graph + geom_violin()
## Warning: Removed 990 rows containing non-finite values (stat_ydensity).
labor_graph + geom_violin() + geom_boxplot(width = .25, fill = "grey80") +
stat_summary(fun.y = "mean", geom = "point", shape = 23, size = 4, )
## Warning: Removed 990 rows containing non-finite values (stat_ydensity).
## Warning: Removed 990 rows containing non-finite values (stat_boxplot).
## Warning: Removed 990 rows containing non-finite values (stat_summary).