<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>Hola Antonio, hice algunas suposiciones para completar el código
      y que corriera ... y dibuja bien los gráficos ... te envío
      adjuntos los primeros 10 que hice para probar:<br>
    </p>
    <p>Dos detalles para que funcionara:</p>
    <p>1. La variable INDEX SUMMARY no tiene punto en el data.frame,
      pero sí en el código, de modo que Y aparecía vacío por ese motivo.<br>
    </p>
    <p>2. En el data.frame se usa coma para el decimal, y al menos en mi
      compu tengo q usar punto ... con coma no funciona.</p>
    <p>Este es el código:<br>
    </p>
    <p>library(data.table)<br>
      setwd("/home/neo/Desktop/Rhelp/")<br>
      eco_freedom2 <- fread("EconomicFreedom.csv")<br>
      countrylist <- eco_freedom2[["Countries"]]<br>
      i <- 1<br>
      for (i in 1:10){<br>
          currcty <- countrylist[i]<br>
          filename <- paste("index",currcty,".png",sep="")<br>
          png(filename,width=800,height=600)<br>
         
plot(y=eco_freedom2$SUMMARY.INDEX[eco_freedom2$Countries==currcty],x=eco_freedom2$Year[eco_freedom2$Countries==currcty],
      type="l",ylab="INDEX",xlab="YEAR",main = paste("Countries",
      currcty))<br>
          dev.off()<br>
        }<br>
    </p>
    <p><br>
    </p>
    <p><br>
    </p>
    <p>Espero te sirva,</p>
    <p>Saludos !!</p>
    <p>Eric.<br>
    </p>
    <p><br>
    </p>
    <div class="moz-cite-prefix">On 04-09-19 14:52, Antonio Rodriguez
      Andres wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAPr+-cPoxN6LR+9k63sTd05kfrNRNZmPU_Mbu5ouAWXrHpQE0g@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">Aqui estan en formato csv,
        <div><br>
        </div>
        <div>Antonio</div>
      </div>
      <br>
      <div class="gmail_quote">
        <div dir="ltr" class="gmail_attr">On Wed, 4 Sep 2019 at 19:19,
          Carlos Ortega <<a href="mailto:cof@qualityexcellence.es"
            moz-do-not-send="true">cof@qualityexcellence.es</a>>
          wrote:<br>
        </div>
        <blockquote class="gmail_quote" style="margin:0px 0px 0px
          0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
          <div dir="ltr">
            <div class="gmail_default"
              style="font-family:verdana,sans-serif;font-size:small">¿Puedes
              compartir los datos?...</div>
            <div class="gmail_default"
              style="font-family:verdana,sans-serif;font-size:small">No
              veo otra forma...<br>
            </div>
          </div>
          <br>
          <div class="gmail_quote">
            <div dir="ltr" class="gmail_attr">El mié., 4 sept. 2019 a
              las 18:54, Antonio Rodriguez Andres (<<a
                href="mailto:antoniorodriguezandres70@gmail.com"
                target="_blank" moz-do-not-send="true">antoniorodriguezandres70@gmail.com</a>>)
              escribió:<br>
            </div>
            <blockquote class="gmail_quote" style="margin:0px 0px 0px
              0.8ex;border-left:1px solid
              rgb(204,204,204);padding-left:1ex">
              <div dir="ltr">No me sale error pero no me imprime la
                linea, ni ningun gráfico por pais.</div>
              <br>
              <div class="gmail_quote">
                <div dir="ltr" class="gmail_attr">On Wed, 4 Sep 2019 at
                  18:42, neo <<a
                    href="mailto:ericconchamunoz@gmail.com"
                    target="_blank" moz-do-not-send="true">ericconchamunoz@gmail.com</a>>
                  wrote:<br>
                </div>
                <blockquote class="gmail_quote" style="margin:0px 0px
                  0px 0.8ex;border-left:1px solid
                  rgb(204,204,204);padding-left:1ex">podría ser el
                  problema el tipo de dato en X y el tipo de gráfico que
                  <br>
                  intentas hacer ?<br>
                  <br>
                  si Year es entero y estas pidiendo que el gráfico sea
                  tipo "I", podría <br>
                  ser que quizá eso te produce el error ?<br>
                  <br>
                  si pruebas a cambiar X a numérico (continuo) ?<br>
                  <br>
                  Slds,<br>
                  <br>
                  Eric.<br>
                  <br>
                  <br>
                  <br>
                  <br>
                  On 04-09-19 13:06, Antonio Rodriguez Andres wrote:<br>
                  > Lo que obtengo es dim(currcty)  = NULL<br>
                  ><br>
                  > lo que hice es crear una lista de paises<br>
                  ><br>
                  > countrylist <-
                  unique(length(eco_freedom2$Countries)<br>
                  ><br>
                  > Los datos son de esta forma<br>
                  > head(eco_freedom2, 5)<br>
                  >      Year ISO_Code Countries SUMMARY.INDEX
                  X1..Size.of.Government<br>
                  > 641 2000      AGO    Angola            NA       
                               NA<br>
                  > 601 2001      AGO    Angola            NA       
                               NA<br>
                  > 561 2002      AGO    Angola            NA       
                               NA<br>
                  > 521 2003      AGO    Angola            NA       
                               NA<br>
                  > 481 2004      AGO    Angola            NA       
                               NA<br>
                  ><br>
                  > On Wed, 4 Sep 2019 at 16:53, Carlos Ortega <<a
                    href="mailto:cof@qualityexcellence.es"
                    target="_blank" moz-do-not-send="true">cof@qualityexcellence.es</a>>
                  wrote:<br>
                  ><br>
                  >> ¿Puedes compartir los datos?..<br>
                  >><br>
                  >> Otra cosa que puede ayudar es esto lo destaco
                  en rojo.<br>
                  >> Creo que en alguno de los casos te quedas sin
                  datos en tu data.frame.<br>
                  >><br>
                  >> Con ese mensaje puedes ver justamente el
                  tamaño de cada dataframe en cada<br>
                  >> iteración.<br>
                  >><br>
                  >><br>
                  >> for (i in 1:length(countrylist)){<br>
                  >>       currcty <- countrylist[i]<br>
                  >>      * print(dim(currcty))*<br>
                  >>      filename <-
                  paste("index",currcty,".png",sep="")<br>
                  >>      png(filename,width=800,height=600)<br>
                  >><br>
                  >>
                  plot(y=eco_freedom3$SUMMARY.INDEX[eco_freedom3$Countries==currcty],<br>
                  >>
                  x=eco_freedom3$Year[eco_freedom3$Countries==currcty],
                  ylim = c(2.85, 8.20),<br>
                  >> xlim = c(2000, 2016), type="l",
                  ylab="INDEX",xlab="YEAR", main =<br>
                  >> paste("Countries", currcty))<br>
                  >>      dev.off()<br>
                  >>    }<br>
                  >><br>
                  >> El mié., 4 sept. 2019 a las 14:52, Antonio
                  Rodriguez Andres (<<br>
                  >> <a
                    href="mailto:antoniorodriguezandres70@gmail.com"
                    target="_blank" moz-do-not-send="true">antoniorodriguezandres70@gmail.com</a>>)
                  escribió:<br>
                  >><br>
                  >>> Carlos<br>
                  >>> Al especificar los limites, no me sale
                  ningun error, aunque no consigue<br>
                  >>> graficar, nada,<br>
                  >>><br>
                  >>><br>
                  >>>    # Look at the time series for each
                  country for the time period, for<br>
                  >>> instance GDPPC<br>
                  >>>    for (i in 1:length(countrylist)){<br>
                  >>>       currcty <- countrylist[i]<br>
                  >>>      filename <-
                  paste("index",currcty,".png",sep="")<br>
                  >>>      png(filename,width=800,height=600)<br>
                  >>><br>
                  >>>
                  plot(y=eco_freedom3$SUMMARY.INDEX[eco_freedom3$Countries==currcty],<br>
                  >>>
                  x=eco_freedom3$Year[eco_freedom3$Countries==currcty],
                  ylim = c(2.85, 8.20),<br>
                  >>> xlim = c(2000, 2016), type="l",
                  ylab="INDEX",xlab="YEAR",<br>
                  >>>           main = paste("Countries",
                  currcty))<br>
                  >>>      dev.off()<br>
                  >>>    }<br>
                  >>><br>
                  >>> On Wed, 4 Sep 2019 at 11:57, Carlos
                  Ortega <<a href="mailto:cof@qualityexcellence.es"
                    target="_blank" moz-do-not-send="true">cof@qualityexcellence.es</a>><br>
                  >>> wrote:<br>
                  >>><br>
                  >>>> Hola,<br>
                  >>>><br>
                  >>>> Pon un "print(i)" en tu bucle para
                  ver en qué número/paso del bucle te<br>
                  >>>> aparece el error.<br>
                  >>>> Y con ese "i" haz la selección del
                  dataframe y mira que pasa.. puede que<br>
                  >>>> para ese caso, al quitar los NAs te
                  quedes sin datos...<br>
                  >>>><br>
                  >>>> Es una forma de debugear...<br>
                  >>>><br>
                  >>>> Gracias,<br>
                  >>>> Carlos Ortega<br>
                  >>>> <a
                    href="http://www.qualityexcellence.es"
                    rel="noreferrer" target="_blank"
                    moz-do-not-send="true">www.qualityexcellence.es</a><br>
                  >>>><br>
                  >>>><br>
                  >>>> El mié., 4 sept. 2019 a las 11:17,
                  Antonio Rodriguez Andres (<<br>
                  >>>> <a
                    href="mailto:antoniorodriguezandres70@gmail.com"
                    target="_blank" moz-do-not-send="true">antoniorodriguezandres70@gmail.com</a>>)
                  escribió:<br>
                  >>>><br>
                  >>>>> Hola queridos usuarios de R<br>
                  >>>>><br>
                  >>>>> Estoy intentando hacer un gráfico
                  de una variable en el tiempo para un<br>
                  >>>>> conjunto de países usando R base,
                  con el comando plot. Tengo 40 países y<br>
                  >>>>> son 15 años. Lo quiero salvar
                  como formato png, cada uno de ellos.<br>
                  >>>>><br>
                  >>>>> Tengo el siguiente código,<br>
                  >>>>><br>
                  >>>>> for (i in 1:length(countrylist)){<br>
                  >>>>>      currcty <- countrylist[i]<br>
                  >>>>>      filename <-
                  paste("index",currcty,".png",sep="")<br>
                  >>>>>     
                  png(filename,width=800,height=600)<br>
                  >>>>><br>
                  >>>>>
                  plot(y=eco_freedom2$SUMMARY.INDEX[eco_freedom2$Countries==currcty],<br>
                  >>>>>
                  x=eco_freedom2$Year[eco_freedom2$Countries==currcty],
                  type="l",<br>
                  >>>>> ylab="INDEX",xlab="YEAR",<br>
                  >>>>>           main =
                  paste("Countries", currcty))<br>
                  >>>>>      dev.off()<br>
                  >>>>>    }<br>
                  >>>>><br>
                  >>>>> Pero me aparece el error Error in
                  plot.window(...) : se necesitan<br>
                  >>>>> valores<br>
                  >>>>> finitos de 'xlim'. La variable y
                  = SUMMARY.INDEX tiene valores Nas, y es<br>
                  >>>>> tipo numerico, y la variable x=
                  Year es integer. Entiendo que es por el<br>
                  >>>>> problema de los NAs, por lo que
                  da error.<br>
                  >>>>> Si embargo al usar
                  na.omit(dataset), y quedarnos con los valores que no<br>
                  >>>>> son<br>
                  >>>>> NA, me sigue saliendo el mismo
                  error<br>
                  >>>>><br>
                  >>>>> Alguna idea,<br>
                  >>>>><br>
                  >>>>> gracias<br>
                  >>>>><br>
                  >>>>> --<br>
                  >>>>><br>
                  >>>>> Member, Editorial Committee, *The
                  Economic and Labour Relations Review*<br>
                  >>>>> (a<br>
                  >>>>> SAGE journal)<br>
                  >>>>><br>
                  >>>>> <a
                    href="http://elr.sagepub.com/" rel="noreferrer"
                    target="_blank" moz-do-not-send="true">http://elr.sagepub.com/</a><br>
                  >>>>><br>
                  >>>>> Member, Editorial Committee,
                  African Journal of Economic and Management<br>
                  >>>>> Studies<br>
                  >>>>><br>
                  >>>>><br>
                  >>>>> <a
href="http://emeraldgrouppublishing.com/products/journals/editorial_team.htm?id=ajems"
                    rel="noreferrer" target="_blank"
                    moz-do-not-send="true">http://emeraldgrouppublishing.com/products/journals/editorial_team.htm?id=ajems</a><br>
                  >>>>><br>
                  >>>>> <a
                    href="https://www.researchgate.net/profile/Antonio_Andres"
                    rel="noreferrer" target="_blank"
                    moz-do-not-send="true">https://www.researchgate.net/profile/Antonio_Andres</a>
                  (Research Gate<br>
                  >>>>> profile)<br>
                  >>>>><br>
                  >>>>>          [[alternative HTML
                  version deleted]]<br>
                  >>>>><br>
                  >>>>>
                  _______________________________________________<br>
                  >>>>> R-help-es mailing list<br>
                  >>>>> <a
                    href="mailto:R-help-es@r-project.org"
                    target="_blank" moz-do-not-send="true">R-help-es@r-project.org</a><br>
                  >>>>> <a
                    href="https://stat.ethz.ch/mailman/listinfo/r-help-es"
                    rel="noreferrer" target="_blank"
                    moz-do-not-send="true">https://stat.ethz.ch/mailman/listinfo/r-help-es</a><br>
                  >>>>><br>
                  >>>><br>
                  >>>> --<br>
                  >>>> Saludos,<br>
                  >>>> Carlos Ortega<br>
                  >>>> <a
                    href="http://www.qualityexcellence.es"
                    rel="noreferrer" target="_blank"
                    moz-do-not-send="true">www.qualityexcellence.es</a><br>
                  >>>><br>
                  >>><br>
                  >>> --<br>
                  >>><br>
                  >>> Member, Editorial Committee, *The
                  Economic and Labour Relations Review* (a<br>
                  >>> SAGE journal)<br>
                  >>><br>
                  >>> <a href="http://elr.sagepub.com/"
                    rel="noreferrer" target="_blank"
                    moz-do-not-send="true">http://elr.sagepub.com/</a><br>
                  >>><br>
                  >>> Member, Editorial Committee, African
                  Journal of Economic and Management<br>
                  >>> Studies<br>
                  >>><br>
                  >>><br>
                  >>> <a
href="http://emeraldgrouppublishing.com/products/journals/editorial_team.htm?id=ajems"
                    rel="noreferrer" target="_blank"
                    moz-do-not-send="true">http://emeraldgrouppublishing.com/products/journals/editorial_team.htm?id=ajems</a><br>
                  >>><br>
                  >>> <a
                    href="https://www.researchgate.net/profile/Antonio_Andres"
                    rel="noreferrer" target="_blank"
                    moz-do-not-send="true">https://www.researchgate.net/profile/Antonio_Andres</a>
                  (Research Gate<br>
                  >>> profile)<br>
                  >>><br>
                  >>><br>
                  >>><br>
                  >> --<br>
                  >> Saludos,<br>
                  >> Carlos Ortega<br>
                  >> <a href="http://www.qualityexcellence.es"
                    rel="noreferrer" target="_blank"
                    moz-do-not-send="true">www.qualityexcellence.es</a><br>
                  >><br>
                  ><br>
                </blockquote>
              </div>
              <br clear="all">
              <div><br>
              </div>
              -- <br>
              <div dir="ltr"
class="gmail-m_5329400977612333048gmail-m_-4897912158171663752gmail_signature">
                <div dir="ltr">
                  <div>
                    <div dir="ltr">
                      <div dir="ltr">
                        <p style="margin:0cm 0cm
                          0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">Member,
                          Editorial Committee, <i>The Economic and
                            Labour Relations Review</i> (a SAGE journal)</p>
                        <p style="margin:0cm 0cm
                          0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><a
                            href="http://elr.sagepub.com/"
                            style="color:rgb(17,85,204)" target="_blank"
                            moz-do-not-send="true">http://elr.sagepub.com/</a></p>
                        <p style="margin:0cm 0cm
                          0.0001pt;font-size:11pt;font-family:calibri,sans-serif"><span
                            style="font-size:11pt">Member, Editorial
                            Committee, African Journal of Economic and
                            Management Studies</span><br>
                        </p>
                        <p style="font-size:small;margin:0cm 0cm
                          0.0001pt"><font face="Calibri, sans-serif"><span
                              style="font-size:14.6667px"><a
href="http://emeraldgrouppublishing.com/products/journals/editorial_team.htm?id=ajems"
                                target="_blank" moz-do-not-send="true">http://emeraldgrouppublishing.com/products/journals/editorial_team.htm?id=ajems</a></span></font><br>
                        </p>
                        <p style="margin:0cm 0cm
                          0.0001pt;font-size:11pt;font-family:calibri,sans-serif"><a
href="https://www.researchgate.net/profile/Antonio_Andres"
                            style="color:rgb(17,85,204);font-size:14.6667px"
                            target="_blank" moz-do-not-send="true">https://www.researchgate.net/profile/Antonio_Andres</a><span
                            style="font-size:14.6667px"> </span><span
                            style="font-size:14.6667px">(Research Gate
                            profile)</span><br>
                        </p>
                        <p style="font-size:small;margin:0cm 0cm
                          0.0001pt"><br>
                        </p>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </blockquote>
          </div>
          <br clear="all">
          <br>
          -- <br>
          <div dir="ltr"
            class="gmail-m_5329400977612333048gmail_signature"><span
              style="font-family:verdana,sans-serif">Saludos,</span><br
              style="font-family:verdana,sans-serif">
            <span style="font-family:verdana,sans-serif">Carlos Ortega</span><br
              style="font-family:verdana,sans-serif">
            <span style="font-family:verdana,sans-serif"><a
                href="http://www.qualityexcellence.es" target="_blank"
                moz-do-not-send="true">www.qualityexcellence.es</a></span></div>
        </blockquote>
      </div>
      <br clear="all">
      <div><br>
      </div>
      -- <br>
      <div dir="ltr" class="gmail_signature">
        <div dir="ltr">
          <div>
            <div dir="ltr">
              <div dir="ltr">
                <p style="margin:0cm 0cm
                  0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">Member,
                  Editorial Committee, <i>The Economic and Labour
                    Relations Review</i> (a SAGE journal)</p>
                <p style="margin:0cm 0cm
                  0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><a
                    href="http://elr.sagepub.com/"
                    style="color:rgb(17,85,204)" target="_blank"
                    moz-do-not-send="true">http://elr.sagepub.com/</a></p>
                <p style="margin:0cm 0cm
                  0.0001pt;font-size:11pt;font-family:calibri,sans-serif"><span
                    style="font-size:11pt">Member, Editorial Committee,
                    African Journal of Economic and Management Studies</span><br>
                </p>
                <p style="font-size:small;margin:0cm 0cm 0.0001pt"><font
                    face="Calibri, sans-serif"><span
                      style="font-size:14.6667px"><a
href="http://emeraldgrouppublishing.com/products/journals/editorial_team.htm?id=ajems"
                        target="_blank" moz-do-not-send="true">http://emeraldgrouppublishing.com/products/journals/editorial_team.htm?id=ajems</a></span></font><br>
                </p>
                <p style="margin:0cm 0cm
                  0.0001pt;font-size:11pt;font-family:calibri,sans-serif"><a
href="https://www.researchgate.net/profile/Antonio_Andres"
                    style="color:rgb(17,85,204);font-size:14.6667px"
                    target="_blank" moz-do-not-send="true">https://www.researchgate.net/profile/Antonio_Andres</a><span
                    style="font-size:14.6667px"> </span><span
                    style="font-size:14.6667px">(Research Gate profile)</span><br>
                </p>
                <p style="font-size:small;margin:0cm 0cm 0.0001pt"><br>
                </p>
              </div>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
  </body>
</html>