[This article was first published on Learning R, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
fy< -c(1990:2019)
deficit.1< -c(-3.9, -4.5, -4.7, -3.9, -2.9, -2.2, -1.4, -0.3, 0.8, 1.4, 2.4, 1.3, -1.5, -3.5, -3.6, -2.6, -1.9, -1.2, -3.2, -11.2, -9.6, NA,NA, NA, NA, NA, NA, NA, NA, NA)
projected< -c(NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, -9.6, -6.1, -3.7, -3.2, -3.2, -3.1, -3.3, -3.2, -3.1, -3.4)
png(“c:/data/deficit_color.png”,height=480,width=480)
plot(deficit.1~fy,ylim=c(-12,5),type=”n”,lwd=2,col=”red”,
main=”Federal budget deficit, 1990-2019″,
cex.lab=1.1,cex.axis=.75,
xlab=”Fiscal year”,ylab=”Deficit (% of GDP)”)
rect(1988,-15,1994,6,col=”#FF9999″,border=NA)
rect(1994,-15,2002,6,col=”#6699FF”,border=NA)
rect(2002,-15,2010,6,col=”#FF9999″,border=NA)
rect(2010,-15,2014,6,col=”#6699FF”,border=NA)
rect(2014,-15,2021,6,col=”#CCCCCC”,border=NA)
abline(h=0,lwd=.5,lty=3,col=”#555555″)
lines(fy,deficit.1,lwd=2.5)
lines(fy,projected,lwd=2.5,lty=2)
rect(1990,-11.5,2000,-9.5,col=”#dddddd”,border=”#555555″)
text(1995,-10.5,”Source: CBO”)
graphics.off()
To leave a comment for the author, please follow the link and comment on their blog: Learning R.
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.