xbarra <- scan() 34.5 34.2 31.6 31.5 35 34.1 32.6 33.8 34.8 33.6 31.9 38.6 35.4 34 37.1 34.9 33.5 31.7 34 35.1 33.7 32.8 33.5 34.2 R<- scan() 3 4 4 4 5 6 4 3 7 8 3 9 8 6 5 7 4 3 8 4 2 1 3 2 dados<-data.frame(xbarra=xbarra,R=R) # Limites de controle para X barra LIC.Xbarra <- 31.29 LC.Xbarra <- 34 LSC.Xbarra <- 36.72 #Gráfico Xbarra para a amostra toda (xbar <- ggplot(dados, aes(x=1:24, y=xbarra)) + geom_point() + geom_line() + geom_hline(aes(yintercept = LIC.Xbarra), linetype = "solid") + geom_hline(aes(yintercept = LC.Xbarra), linetype = "dotdash") + geom_hline(aes(yintercept = LSC.Xbarra), linetype = "solid") + labs(x= "Amostras", y = "Médias das amostras", title="Gráfico X barra")) # Gráfico de controle para R LIC.R <- 0 LC.R <- 4.71 LSC.R <- 9.96 (r <- ggplot(dados, aes(x = 1:24, y=R)) + geom_point() + geom_line() + geom_hline(aes(yintercept = LIC.R), linetype = "solid") + geom_hline(aes(yintercept = LC.R), linetype = "dotdash") + geom_hline(aes(yintercept = LSC.R), linetype = "solid")+ labs(x= "Amostras", y = "Amplitude das amostras", title="Gráfico R")) # Limites após excluir 12 e 15 dados2 <- dados[-c(12,15),] dados2 xbarrabarra = mean(dados2$xbarra) Rbarra = mean(dados2$R) A2 = 0.577 LSC.Xbarra = xbarrabarra + A2 * Rbarra LIC.Xbarra = xbarrabarra - A2 * Rbarra LC.Xbarra = xbarrabarra #Gráfico Xbarra para a amostra toda (xbar <- ggplot(dados, aes(x=1:24, y=xbarra)) + geom_point() + geom_line() + geom_hline(aes(yintercept = LIC.Xbarra), linetype = "solid") + geom_hline(aes(yintercept = LC.Xbarra), linetype = "dotdash") + geom_hline(aes(yintercept = LSC.Xbarra), linetype = "solid") + labs(x= "Amostras", y = "Médias das amostras", title="Gráfico X barra")) D4 = 2.114 LSC.R = D4 * Rbarra LIC.R = 0 LC.R = Rbarra (r <- ggplot(dados, aes(x = 1:24, y=R)) + geom_point() + geom_line() + geom_hline(aes(yintercept = LIC.R), linetype = "solid") + geom_hline(aes(yintercept = LC.R), linetype = "dotdash") + geom_hline(aes(yintercept = LSC.R), linetype = "solid")+ labs(x= "Amostras", y = "Amplitude das amostras", title="Gráfico R"))