setwd("D:/data/paper")
library(tidyverse)
## -- Attaching packages --------------------------------------- tidyverse 1.3.1 --
## v ggplot2 3.3.5 v purrr 0.3.4
## v tibble 3.1.6 v dplyr 1.0.7
## v tidyr 1.1.4 v stringr 1.4.0
## v readr 2.1.0 v forcats 0.5.1
## -- Conflicts ------------------------------------------ tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::lag() masks stats::lag()
#년도별, gt별, 월별 기동횟수
start<-read.csv("start count.csv")
str(start)
## 'data.frame': 864 obs. of 4 variables:
## $ year : int 2009 2009 2009 2009 2009 2009 2009 2009 2009 2009 ...
## $ month: int 1 2 3 4 5 6 7 8 9 10 ...
## $ gt : chr "#1 GT" "#1 GT" "#1 GT" "#1 GT" ...
## $ count: int 2 7 21 26 7 15 28 25 24 19 ...
strgt<-start %>% group_by(gt) %>% summarise(count=sum(count))
str(strgt)
## tibble [6 x 2] (S3: tbl_df/tbl/data.frame)
## $ gt : chr [1:6] "#1 GT" "#2 GT" "#3 GT" "#4 GT" ...
## $ count: int [1:6] 1554 1490 1488 1426 1622 1637
library(ggplot2)
ggplot(data=strgt,aes(x=gt,y=count))+geom_point()

strmon<-start %>% group_by(month) %>% summarise(count=sum(count))
start$month<-as.factor(start$month)
start$year<-as.factor(start$year)
str(start)
## 'data.frame': 864 obs. of 4 variables:
## $ year : Factor w/ 12 levels "2009","2010",..: 1 1 1 1 1 1 1 1 1 1 ...
## $ month: Factor w/ 12 levels "1","2","3","4",..: 1 2 3 4 5 6 7 8 9 10 ...
## $ gt : chr "#1 GT" "#1 GT" "#1 GT" "#1 GT" ...
## $ count: int 2 7 21 26 7 15 28 25 24 19 ...
strmon<-start %>% group_by(month) %>% summarise(count=sum(count))
ggplot(data=strmon,aes(x=month,y=count))+geom_point()

stryear<-start %>% group_by(year) %>% summarise(count=sum(count))
ggplot(data=stryear,aes(x=year,y=count))+geom_point()

#년도별, gt별, 월별 고장건수
repair<-read.csv("repair.csv")
repair$month<-as.factor(repair$month)
repair$year<-as.factor(repair$year)
str(repair)
## 'data.frame': 103 obs. of 16 variables:
## $ no : int 1 5 7 9 12 13 14 15 16 17 ...
## $ gt : chr "1gt" "1gt" "1gt" "1gt" ...
## $ work : chr "제1발전 G/T 점화기 스프링 교체" "#1 G/T Ignition Exciter 점검" "제1발전 G/T 점화장치 점검" "#1 G/T Ignition Exciter 점검" ...
## $ ma1 : chr "Spring" "Exciter" "Ignitor" "Exciter" ...
## $ ma2 : chr "" "" "" "" ...
## $ ma3 : chr "" "" "" "" ...
## $ mat1 : chr "4" "2" "1" "2" ...
## $ mat2 : chr "-" "-" "-" "-" ...
## $ mat3 : chr "-" "-" "-" "-" ...
## $ date : int 20220415 20201231 20200717 20190919 20181005 20180205 20170731 20160831 20160909 20160930 ...
## $ year : Factor w/ 13 levels "2009","2010",..: 13 11 11 10 9 9 8 7 7 7 ...
## $ month : Factor w/ 12 levels "1","2","3","4",..: 4 12 7 9 10 2 7 8 9 9 ...
## $ day : int 15 31 17 19 5 5 31 31 9 30 ...
## $ cause : chr "경년열화" "부품손상" "부품손상" "부품손상" ...
## $ 증상 : chr "손상" "손상" "손상" "손상" ...
## $ action: chr "점화기 리턴 불량으로 인한 Spring 교체 " "Exciter 동작불량으로 교체" "5번 Ignitor 교체 " "Exciter 동작불량으로 교체" ...
repgt<-repair %>% group_by(gt) %>% summarise(count=n())
str(repgt)
## tibble [6 x 2] (S3: tbl_df/tbl/data.frame)
## $ gt : chr [1:6] "1gt" "2gt" "3gt" "4gt" ...
## $ count: int [1:6] 21 20 17 16 12 17
ggplot(data=repgt,aes(x=gt,y=count))+geom_point()

repyear<-repair %>% group_by(year) %>% summarise(count=n())
ggplot(data=repyear,aes(x=year,y=count))+geom_point()

repmon<-repair %>% group_by(month) %>% summarise(count=n())
ggplot(data=repmon,aes(x=month,y=count))+geom_point()
