You are on page 1of 1

dados <- read.

csv("C:/Users/Manhique/Desktop/Cenas de
Isolamento/Dados_EB_Exer_1.1.csv",
sep = ";", header = T)
dInf <- data.frame(dados[,1])
i = 2
while (i<=8) {
dInf[1,i] = 0
dInf[c(2:26),i] <- ((dados[c(2:26),i]-dados[c(1:25), i])/dados[c(1:25),i])*100
i = i+1
}
names(dInf) <- names(dados)

cores = c("chartreuse3","deepskyblue3","darkorange", "yellow1", "firebrick1",


"turquoise1", "maroon1")
par(bg = "gray80")
plot(dInf$Ano, dInf$EUA, type = "o", pch = 16, col = cores[1],
main = "Taxa de Infla��o dos 7 paises desde 1980 a 2005", xlab = "Ano",
ylab = "Taxa de Infla��o (%)", bty = "l", lwd = 2, ylim = c(-2,20),
mgp = c(1.4, 0.5, 0))
i = -2
while (i<=20) {
abline(h=i, lty = 2)
i = i + 1
}

i = 2
while (i<=8) {
lines(dInf$Ano, dInf[,i], type = "o", pch = 16, col = cores[i-1],
bty = "l", lwd = 2)
i = i + 1
}

legend(2000, 20, legend = names(dInf)[c(2:8)], col = cores,


pch = rep(16, 7), lty = rep(1, 7), lwd = rep(2, 7),
box.col = "white", cex = 0.7, pt.cex = 1.2, text.width = 1.7,
y.intersp = 0.6, x.intersp = 0.2, title = "Legenda",
seg.len = 1, bg = "white")

write.csv(dInf, file = "dadosDeInfla��o.csv", row.names = F, sep = ";") #M�todo


para gravar os dados da taxa de inflac��o num arquivo csv

You might also like