Borrowing heavily from Gilber, I propose a small option. It is emphasized here that it is better to deal with actual objects in a time series, as this, as a rule, allows you to automatically receive types of results that may interest you. Geektrader shows you how to do this with "xts", but you can also do some similar things with R base.
Here's a modified version of the Jilber sample data, where I converted it to a ts object.
set.seed(1) DF <- data.frame(2000:2009,matrix(rnorm(50, 1000, 200), ncol=5)) colnames(DF) <- c('Year', paste0('Country', 2:ncol(DF))) DF.TS <- ts(DF[-1], start = 2000, frequency = 1) DF.TS # Time Series: # Start = 2000 # End = 2009 # Frequency = 1 # Country2 Country3 Country4 Country5 Country6 # 2000 874.7092 1302.3562 1183.7955 1271.7359 967.0953 # 2001 1036.7287 1077.9686 1156.4273 979.4425 949.3277 # 2002 832.8743 875.7519 1014.9130 1077.5343 1139.3927 # 2003 1319.0562 557.0600 602.1297 989.2390 1111.3326 # 2004 1065.9016 1224.9862 1123.9651 724.5881 862.2489 # 2005 835.9063 991.0133 988.7743 917.0011 858.5010 # 2006 1097.4858 996.7619 968.8409 921.1420 1072.9164 # 2007 1147.6649 1188.7672 705.8495 988.1373 1153.7066 # 2008 1115.1563 1164.2442 904.3700 1220.0051 977.5308 # 2009 938.9223 1118.7803 1083.5883 1152.6351 1176.2215
Now, here are two basic building options:

# All countries in one plot... colorful, common scale, and so on plot(DF.TS, plot.type="single", col = 1:ncol(DF.TS)) legend("bottomleft", colnames(DF.TS), col=1:ncol(DF), lty=1, cex=.65)

A5C1D2H2I1M1N2O1R2T1
source share