Multiple line plot in a loop
<p>I have data with different countries, different years and different values for several variables on each country-year. I am trying to plot several multiple line plots (the lines are these variables/year) for each country.</p>

<p>For some unknown reason, the plots I get in return are empty, when running the following command:</p>

<pre><code>par(mfrow=c(5,5))
mysplits&lt;-split(A,A$country)
for (ii in 1:length(mysplits)) {
  adf&lt;-mysplits[[ii]]
  snames&lt;- names(mysplits)[ii]
  p&lt;-plot(1, 
       main=paste(snames),
       type = "n", xlim=c(1993,2015),
       ylab = "value", xlab="years", ylim=c(-50,50))
  lines(adf$year, adf$tone, col = "steelblue", lty=5)
  lines(adf$year, adf$articles, col = "pink", lty=2) 
  lines(adf$year, adf$num, col = "red", lty=3) 
  lines(adf$year, adf$gold, col = "green", lty=6)
  legend("bottomright", legend = c("EPE Public","Tone","Coverage","No of Events",
  "Conflictual"), col = c("black","steelblue","pink","red","green"),
     lty = c(1,5,2,3,6),
     cex = 1.5, seg.len=4)
     }
</code></pre>

<p>Here is the output of <code>dput(head(A))</code>:</p>

<pre><code>structure(list(X = 1:6, country = structure(c(1L, 1L, 1L, 1L, 
1L, 1L), .Label = c("AU", "BE", "BU", "DA", "EN", "EZ", "FI", 
"FR", "GM", "HR", "HU", "IT", "LG", "LH", "LO", "LU", "MT", "NL", 
"PL", "RO", "SI", "SP", "SW"), class = "factor"), year = 1994:1999, 
gold = c(-0.571428571, -2.4, 1.26, -0.2, -0.966666667, 0.316666667
), tone = c(324L, 239L, 251L, 72L, 61L, 159L), articles = c(3.571428571, 
4.5, 8.2, 4.6, 9.333333333, 6.166666667), num = c(7L, 4L, 
5L, 5L, 6L, 6L), yepe = 1995:2000, couepe = structure(c(1L, 
1L, 1L, 1L, 1L, 1L), .Label = c("AU", "BE", "BU", "DA", "EN", 
"EZ", "FI", "FR", "GM", "HR", "HU", "IT", "LG", "LH", "LO", 
"LU", "MT", "NL", "PL", "RO", "SI", "SP", "SW"), class = "factor"), 
epepub = c(2.01, 1.87, 0.55, 0.63, 0.52, 0.82), epepriv = c(NA, 
NA, 2.63, 2.71, 2.59, 2.12), epeind = c(0.65, 0.66, 0.72, 
0.63, 0.57, 0.53)), .Names = c("X", "country", "year", "gold", 
"tone", "articles", "num", "yepe", "couepe", "epepub", "epepriv", 
"epeind"), row.names = c(NA, 6L), class = "data.frame")
</code></pre>

<hr>

<p>Here is an image of my data:</p>

<p><img src="https://i.stack.imgur.com/jFjZw.png" alt="Header data"></p>