Skip to content

Instantly share code, notes, and snippets.

@Shreyes2010
Created March 10, 2012 09:58
Show Gist options
  • Save Shreyes2010/2011012 to your computer and use it in GitHub Desktop.
Save Shreyes2010/2011012 to your computer and use it in GitHub Desktop.
IFE_Assignment
data <- read.csv("IFE_Update.csv")
# Plotting the foreign reserves of all the countries
png("IR_Relative.png", height = 800, width = 1000)
par(mfrow = c(3, 2)) ## This is to specify the number of rows and columns you want for the plots
# India
plot(data$Index, (data$India.Millions/max(data$India.Millions[!is.na(data$India.Millions)])),
type="l", xlab= "Months", ylab= "Foreign reserves (in $ millions)", col="green", lwd = 2,
main ="India's foreign reserves since 2002")
abline(v=79, lty="dotted", col = "black", lwd = 2)
abline(v=102, lty="dotted", col = "black", lwd = 2)
# Egypt
plot(data$Index, (data$Egypt.Millions./max(data$Egypt.Millions.[!is.na(data$Egypt.Millions.)])),
type="l", xlab= "Months", ylab= "Foreign reserves (in $ millions)", col="red", lwd = 2,
main ="Egypt's foreign reserves since 2002")
abline(v=79, lty="dotted", col = "black", lwd = 2)
abline(v=102, lty="dotted", col = "black", lwd = 2)
# Jordan
plot(data$Index, (data$Jordan.Millions./max(data$Jordan.Millions.[!is.na(data$Jordan.Millions.)])),
type="l", xlab= "Months", ylab= "Foreign reserves (in $ millions)", col="royalblue", lwd = 2,
main ="Jordan's foreign reserves since 2002")
abline(v=79, lty="dotted", col = "black", lwd = 2)
abline(v=102, lty="dotted", col = "black", lwd = 2)
# Pakistan
plot(data$Index, (data$Pakistan.Millions./max(data$Pakistan.Millions.[!is.na(data$Pakistan.Millions.)])),
type="l", xlab= "Months", ylab= "Foreign reserves (in $ millions)", col="black", lwd = 2,
main ="Pakistan's foreign reserves since 2002")
abline(v=79, lty="dotted", col = "black", lwd = 2)
abline(v=102, lty="dotted", col = "black", lwd = 2)
# Sri lanka
plot(data$Index, (data$Sri.Lanka.Millions./max(data$Sri.Lanka.Millions.[!is.na(data$Sri.Lanka.Millions.)])),
type="l", xlab= "Months", ylab= "Foreign reserves (in $ millions)", col="purple", lwd = 2,
main ="Srilanka's foreign reserves since 2002")
abline(v=79, lty="dotted", col = "black", lwd = 2)
abline(v=102, lty="dotted", col = "black", lwd = 2)
# Banglasdesh
plot(data$Index, (data$Bangladesh.Millions./max(data$Bangladesh.Millions.[!is.na(data$Bangladesh.Millions.)])),
type="l", xlab= "Months", ylab= "Foreign reserves (in $ millions)", col="cyan", lwd = 2,
main ="Bangladesh's foreign reserves since 2002")
abline(v=79, lty="dotted", col = "black", lwd = 2)
abline(v=102, lty="dotted", col = "black", lwd = 2)
dev.off()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment