Después del "gather()" puedes hacer un "arrange()" que es una ordenación. Y dentro de "arrange()" le indicas la variable por la que ordenas (no hacen falta comillas)... Lo ordenará alfabéticamente. Saludos, Carlos Ortega www.qualityexcellence.es El mar., 19 feb. 2019 a las 13:47, Antonio Rodriguez Andres (< antoniorodriguezandres70 en gmail.com>) escribió:> Carlos, para poner despues del gather, las observaciones e Afganistan para > todos los años consecutivos, alguna pista? > > Afghanistan year60 8996351 > 2 Albania year60 1608800 > 3 Algeria year60 11124888 > 4 Andorra year60 13411 > 5 Angola year60 5643182 > 6 Afghanistan year61 9166764 > 7 Albania year61 1659800 > > On Tue, 19 Feb 2019 at 13:31, Antonio Rodriguez Andres < > antoniorodriguezandres70 en gmail.com> wrote: > >> > gather(pobla, key = year, value = totpop, year60:year63) >> >> Country year totpop >> 1 Afghanistan year60 8996351 >> 2 Albania year60 1608800 >> 3 Algeria year60 11124888 >> 4 Andorra year60 13411 >> >> Gracias Carlos >> >> Antonio >> >> On Tue, 19 Feb 2019 at 12:54, Carlos Ortega <cof en qualityexcellence.es> >> wrote: >> >>> Sí, tienes varias formas. >>> >>> Mira la función "gather()" del paquete "tidyr", es la que te va a >>> resultar más fácil de usar. >>> >>> Gracias, >>> Carlos Ortega >>> www.qualityexcellence.es >>> >>> El mar., 19 feb. 2019 a las 9:51, Antonio Rodriguez Andres (< >>> antoniorodriguezandres70 en gmail.com>) escribió: >>> >>>> Estimados miembros de la comunidad de R >>>> >>>> Tengo el siguiente formato en un fichero csv que corresponde a datos de >>>> la >>>> población para un conjunto de países y para un rango amplio de años. >>>> >>>> Pais 1960 1961 1962 1963 >>>> Albania vvvvv vvvv >>>> Algeria vvvvv vvvv >>>> >>>> Me gustaría pasarlo a la siguiente forma >>>> Pais Año Poblacion >>>> Albania 1960 vvv >>>> Albania 1961 vvvv >>>> Albania 1962 >>>> Albania 1963 >>>> Algeria 1960 >>>> .....etc >>>> >>>> Alguna pista de como implementarlo en R. Muchas gracias de antemano >>>> >>>> Saludos >>>> >>>> Antonio >>>> >>>> [[alternative HTML version deleted]] >>>> >>>> _______________________________________________ >>>> R-help-es mailing list >>>> R-help-es en 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) >> >> >> > > -- > > 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) > > >-- Saludos, Carlos Ortega www.qualityexcellence.es [[alternative HTML version deleted]]
Gracias, ya lo tengo gather(pobla, key = year, value = totpop, year60:year63) %>% + arrange(Country) Country year totpop 1 Afghanistan year60 8996351 2 Afghanistan year61 9166764 3 Afghanistan year62 9345868 4 Afghanistan year63 9533954 On Tue, 19 Feb 2019 at 14:17, Carlos Ortega <cof en qualityexcellence.es> wrote:> Después del "gather()" puedes hacer un "arrange()" que es una ordenación. > Y dentro de "arrange()" le indicas la variable por la que ordenas (no hacen > falta comillas)... > Lo ordenará alfabéticamente. > > Saludos, > Carlos Ortega > www.qualityexcellence.es > > El mar., 19 feb. 2019 a las 13:47, Antonio Rodriguez Andres (< > antoniorodriguezandres70 en gmail.com>) escribió: > >> Carlos, para poner despues del gather, las observaciones e Afganistan >> para todos los años consecutivos, alguna pista? >> >> Afghanistan year60 8996351 >> 2 Albania year60 1608800 >> 3 Algeria year60 11124888 >> 4 Andorra year60 13411 >> 5 Angola year60 5643182 >> 6 Afghanistan year61 9166764 >> 7 Albania year61 1659800 >> >> On Tue, 19 Feb 2019 at 13:31, Antonio Rodriguez Andres < >> antoniorodriguezandres70 en gmail.com> wrote: >> >>> > gather(pobla, key = year, value = totpop, year60:year63) >>> >>> Country year totpop >>> 1 Afghanistan year60 8996351 >>> 2 Albania year60 1608800 >>> 3 Algeria year60 11124888 >>> 4 Andorra year60 13411 >>> >>> Gracias Carlos >>> >>> Antonio >>> >>> On Tue, 19 Feb 2019 at 12:54, Carlos Ortega <cof en qualityexcellence.es> >>> wrote: >>> >>>> Sí, tienes varias formas. >>>> >>>> Mira la función "gather()" del paquete "tidyr", es la que te va a >>>> resultar más fácil de usar. >>>> >>>> Gracias, >>>> Carlos Ortega >>>> www.qualityexcellence.es >>>> >>>> El mar., 19 feb. 2019 a las 9:51, Antonio Rodriguez Andres (< >>>> antoniorodriguezandres70 en gmail.com>) escribió: >>>> >>>>> Estimados miembros de la comunidad de R >>>>> >>>>> Tengo el siguiente formato en un fichero csv que corresponde a datos >>>>> de la >>>>> población para un conjunto de países y para un rango amplio de años. >>>>> >>>>> Pais 1960 1961 1962 1963 >>>>> Albania vvvvv vvvv >>>>> Algeria vvvvv vvvv >>>>> >>>>> Me gustaría pasarlo a la siguiente forma >>>>> Pais Año Poblacion >>>>> Albania 1960 vvv >>>>> Albania 1961 vvvv >>>>> Albania 1962 >>>>> Albania 1963 >>>>> Algeria 1960 >>>>> .....etc >>>>> >>>>> Alguna pista de como implementarlo en R. Muchas gracias de antemano >>>>> >>>>> Saludos >>>>> >>>>> Antonio >>>>> >>>>> [[alternative HTML version deleted]] >>>>> >>>>> _______________________________________________ >>>>> R-help-es mailing list >>>>> R-help-es en 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) >>> >>> >>> >> >> -- >> >> 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) >> >> >> > > -- > 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]]
Me alegro! El mar., 19 feb. 2019 a las 15:16, Antonio Rodriguez Andres (< antoniorodriguezandres70 en gmail.com>) escribió:> Gracias, ya lo tengo > > gather(pobla, key = year, value = totpop, year60:year63) %>% > + arrange(Country) > Country year totpop > 1 Afghanistan year60 8996351 > 2 Afghanistan year61 9166764 > 3 Afghanistan year62 9345868 > 4 Afghanistan year63 9533954 > > On Tue, 19 Feb 2019 at 14:17, Carlos Ortega <cof en qualityexcellence.es> > wrote: > >> Después del "gather()" puedes hacer un "arrange()" que es una ordenación. >> Y dentro de "arrange()" le indicas la variable por la que ordenas (no hacen >> falta comillas)... >> Lo ordenará alfabéticamente. >> >> Saludos, >> Carlos Ortega >> www.qualityexcellence.es >> >> El mar., 19 feb. 2019 a las 13:47, Antonio Rodriguez Andres (< >> antoniorodriguezandres70 en gmail.com>) escribió: >> >>> Carlos, para poner despues del gather, las observaciones e Afganistan >>> para todos los años consecutivos, alguna pista? >>> >>> Afghanistan year60 8996351 >>> 2 Albania year60 1608800 >>> 3 Algeria year60 11124888 >>> 4 Andorra year60 13411 >>> 5 Angola year60 5643182 >>> 6 Afghanistan year61 9166764 >>> 7 Albania year61 1659800 >>> >>> On Tue, 19 Feb 2019 at 13:31, Antonio Rodriguez Andres < >>> antoniorodriguezandres70 en gmail.com> wrote: >>> >>>> > gather(pobla, key = year, value = totpop, year60:year63) >>>> >>>> Country year totpop >>>> 1 Afghanistan year60 8996351 >>>> 2 Albania year60 1608800 >>>> 3 Algeria year60 11124888 >>>> 4 Andorra year60 13411 >>>> >>>> Gracias Carlos >>>> >>>> Antonio >>>> >>>> On Tue, 19 Feb 2019 at 12:54, Carlos Ortega <cof en qualityexcellence.es> >>>> wrote: >>>> >>>>> Sí, tienes varias formas. >>>>> >>>>> Mira la función "gather()" del paquete "tidyr", es la que te va a >>>>> resultar más fácil de usar. >>>>> >>>>> Gracias, >>>>> Carlos Ortega >>>>> www.qualityexcellence.es >>>>> >>>>> El mar., 19 feb. 2019 a las 9:51, Antonio Rodriguez Andres (< >>>>> antoniorodriguezandres70 en gmail.com>) escribió: >>>>> >>>>>> Estimados miembros de la comunidad de R >>>>>> >>>>>> Tengo el siguiente formato en un fichero csv que corresponde a datos >>>>>> de la >>>>>> población para un conjunto de países y para un rango amplio de años. >>>>>> >>>>>> Pais 1960 1961 1962 1963 >>>>>> Albania vvvvv vvvv >>>>>> Algeria vvvvv vvvv >>>>>> >>>>>> Me gustaría pasarlo a la siguiente forma >>>>>> Pais Año Poblacion >>>>>> Albania 1960 vvv >>>>>> Albania 1961 vvvv >>>>>> Albania 1962 >>>>>> Albania 1963 >>>>>> Algeria 1960 >>>>>> .....etc >>>>>> >>>>>> Alguna pista de como implementarlo en R. Muchas gracias de antemano >>>>>> >>>>>> Saludos >>>>>> >>>>>> Antonio >>>>>> >>>>>> [[alternative HTML version deleted]] >>>>>> >>>>>> _______________________________________________ >>>>>> R-help-es mailing list >>>>>> R-help-es en 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) >>>> >>>> >>>> >>> >>> -- >>> >>> 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) >>> >>> >>> >> >> -- >> 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) > > >-- Saludos, Carlos Ortega www.qualityexcellence.es [[alternative HTML version deleted]]