Ok gracias On Wed, 4 Sep 2019 at 11:57, Carlos Ortega <c...@qualityexcellence.es> wrote:
> Hola, > > Pon un "print(i)" en tu bucle para ver en qué número/paso del bucle te > aparece el error. > Y con ese "i" haz la selección del dataframe y mira que pasa.. puede que > para ese caso, al quitar los NAs te quedes sin datos... > > Es una forma de debugear... > > Gracias, > Carlos Ortega > www.qualityexcellence.es > > > El mié., 4 sept. 2019 a las 11:17, Antonio Rodriguez Andres (< > antoniorodriguezandre...@gmail.com>) escribió: > >> Hola queridos usuarios de R >> >> Estoy intentando hacer un gráfico de una variable en el tiempo para un >> conjunto de países usando R base, con el comando plot. Tengo 40 países y >> son 15 años. Lo quiero salvar como formato png, cada uno de ellos. >> >> Tengo el siguiente código, >> >> for (i in 1:length(countrylist)){ >> currcty <- countrylist[i] >> filename <- paste("index",currcty,".png",sep="") >> png(filename,width=800,height=600) >> >> 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)) >> dev.off() >> } >> >> Pero me aparece el error Error in plot.window(...) : se necesitan valores >> finitos de 'xlim'. La variable y = SUMMARY.INDEX tiene valores Nas, y es >> tipo numerico, y la variable x= Year es integer. Entiendo que es por el >> problema de los NAs, por lo que da error. >> Si embargo al usar na.omit(dataset), y quedarnos con los valores que no >> son >> NA, me sigue saliendo el mismo error >> >> Alguna idea, >> >> gracias >> >> -- >> >> Member, Editorial Committee, *The Economic and Labour Relations Review* (a >> SAGE journal) >> >> http://elr.sagepub.com/ >> >> Member, Editorial Committee, African Journal of Economic and Management >> Studies >> >> >> http://emeraldgrouppublishing.com/products/journals/editorial_team.htm?id=ajems >> >> https://www.researchgate.net/profile/Antonio_Andres (Research Gate >> profile) >> >> [[alternative HTML version deleted]] >> >> _______________________________________________ >> R-help-es mailing list >> R-help-es@r-project.org >> https://stat.ethz.ch/mailman/listinfo/r-help-es >> > > > -- > Saludos, > Carlos Ortega > www.qualityexcellence.es > -- Member, Editorial Committee, *The Economic and Labour Relations Review* (a SAGE journal) http://elr.sagepub.com/ Member, Editorial Committee, African Journal of Economic and Management Studies http://emeraldgrouppublishing.com/products/journals/editorial_team.htm?id=ajems https://www.researchgate.net/profile/Antonio_Andres (Research Gate profile) [[alternative HTML version deleted]] _______________________________________________ R-help-es mailing list R-help-es@r-project.org https://stat.ethz.ch/mailman/listinfo/r-help-es