makhija.sangeeta at gmail.com
2009-Oct-22 07:46 UTC
[R] Help regarding removing Inf from dataframe, creating new dataframe with selected variables, count function
Following is my query: 1. Removing Inf from one column of dataframe. 2. out of 10 available dates, count how many times a security is present. (repeat for each security) 3. Out of dates, the security is present, I want to read latest status of market cap. 4. Change in market cap represent by 0/1 so even if market cap status changed once, take value 1. 5. create output file containing some already existed variables and newly created variables. following is sample data: Date AssetId Name Country Liquidity MCName 2006_12_31 322833 YPF 'D' Argentina 1 LC 2006_12_31 321948 TELECOM ARGN.'B' Argentina 1 LC 2006_12_31 320205 TELEFONICA DE ARGN.'B' Argentina 1 LC 2007_12_31 874140 YPF 'D' Argentina 1 LC 2006_12_31 281678 PETROBRAS ENGA.PPC.'B' Argentina 1 LC 2006_12_31 992260 PETROBRAS ENERGIA 'B' Argentina 1 LC 2007_12_31 320148 TELECOM ARGN.'B' Argentina 1 MC 2006_12_31 131879 BANCO MACRO 'B' Argentina 1 MC 2008_12_31 677693 YPF 'D' Argentina 1 MC 2006_12_31 149482 TSPA.GAS DEL SUR 'B' Argentina 1 MC 2008_12_31 696138 TELECOM ARGN.'B' Argentina 1 MC 2006_12_31 298819 GRUPO FINO.GALICIA 'B' Argentina 1 MC 2006_12_31 982990 BANCO GALICIA 'B' Argentina 0 SC 2006_12_31 322661 IRSA 'B' Argentina 1 SC 2006_12_31 992128 INDUPA 'B' Argentina 1 SC 2006_12_31 320053 BBVA BANCO FRANCES 'B' Argentina 1 SC 2006_12_31 992183 MOLINOS RIO PLATA 'B' Argentina 1 SC 2006_12_31 320096 MINETTI(J) 'B' Argentina 1 SC 2006_12_31 322656 PAMPA ENERGIA Argentina 0 SC 2006_12_31 982902 CRESUD 'B' Argentina 1 SC 2006_12_31 992156 LEDESMA 'B' Argentina 1 SC 2006_12_31 265532 TRANSENER 'B' Argentina 1 SC 2006_12_31 982616 ACINDAR 'B' DEAD - DELIST.29/01/09 Argentina 1 SC 2006_12_31 884387 ALTO PALERMO 'B' Argentina 0 SC 2006_12_31 134841 METROGAS 'B' Argentina 1 SC 2006_12_31 992126 IMPORT&EXPORT PATAG.'B' Argentina 0 SC 2006_12_31 677414 GAS NATURAL 'B' Argentina 1 SC 2006_12_31 151203 CAPEX 'A' Argentina 1 SC 2006_12_31 322652 BOLDT 'B' Argentina 1 SC 2006_12_31 255169 CAMUZZI GAS PAMPEANA 'B' Argentina 1 SC 2006_12_31 134627 ENDESA COSTANERA 'B' Argentina 1 SC 2006_12_31 134645 CENTRAL PUERTO 'B' Argentina 1 SC 2006_12_31 320158 CELULOSA 'B' Argentina 1 SC 2006_12_31 982620 ALPARGATAS Argentina 1 SC 2006_12_31 982904 RIGOLLEAU 'B' Argentina 1 SC 2006_12_31 689402 SAN LORENZO 'B' Argentina 1 SC 2006_12_31 982655 CARLOS CASADO 'B' Argentina 1 SC 2006_12_31 982933 FERRUM 'B' Argentina 0 SC 2006_12_31 286752 DISB.DE GAS CUYANA 'B' Argentina 1 SC 2006_12_31 151196 MIRGOR 'C' Argentina 1 SC 2006_12_31 50923T TSPA.DE GS.DEL NORTE 'C' Argentina 0 SC 2006_12_31 286047 GPO.CONCIO.DEL OESTE 'B' Argentina 0 SC 2006_12_31 322664 CARBOCLOR 'B' Argentina 1 SC
Uwe Ligges
2009-Oct-24 16:58 UTC
[R] Help regarding removing Inf from dataframe, creating new dataframe with selected variables, count function
makhija.sangeeta at gmail.com wrote:> Following is my query: > 1. Removing Inf from one column of dataframe. > 2. out of 10 available dates, count how many times a security is present. (repeat for each security) > 3. Out of dates, the security is present, I want to read latest status of market cap. > 4. Change in market cap represent by 0/1 so even if market cap status changed once, take value 1. > 5. create output file containing some already existed variables and newly created variables.You are posting your whole data analysis problem to the list. Fine, but you forgot to say how much you are paying for those consultants who solve your problem and you forgot to tell the address where the invoice should go to. Please do read the posting guide. Uwe Ligges> following is sample data: > Date AssetId Name Country Liquidity MCName > 2006_12_31 322833 YPF 'D' Argentina 1 LC > 2006_12_31 321948 TELECOM ARGN.'B' Argentina 1 LC > 2006_12_31 320205 TELEFONICA DE ARGN.'B' Argentina 1 LC > 2007_12_31 874140 YPF 'D' Argentina 1 LC > 2006_12_31 281678 PETROBRAS ENGA.PPC.'B' Argentina 1 LC > 2006_12_31 992260 PETROBRAS ENERGIA 'B' Argentina 1 LC > 2007_12_31 320148 TELECOM ARGN.'B' Argentina 1 MC > 2006_12_31 131879 BANCO MACRO 'B' Argentina 1 MC > 2008_12_31 677693 YPF 'D' Argentina 1 MC > 2006_12_31 149482 TSPA.GAS DEL SUR 'B' Argentina 1 MC > 2008_12_31 696138 TELECOM ARGN.'B' Argentina 1 MC > 2006_12_31 298819 GRUPO FINO.GALICIA 'B' Argentina 1 MC > 2006_12_31 982990 BANCO GALICIA 'B' Argentina 0 SC > 2006_12_31 322661 IRSA 'B' Argentina 1 SC > 2006_12_31 992128 INDUPA 'B' Argentina 1 SC > 2006_12_31 320053 BBVA BANCO FRANCES 'B' Argentina 1 SC > 2006_12_31 992183 MOLINOS RIO PLATA 'B' Argentina 1 SC > 2006_12_31 320096 MINETTI(J) 'B' Argentina 1 SC > 2006_12_31 322656 PAMPA ENERGIA Argentina 0 SC > 2006_12_31 982902 CRESUD 'B' Argentina 1 SC > 2006_12_31 992156 LEDESMA 'B' Argentina 1 SC > 2006_12_31 265532 TRANSENER 'B' Argentina 1 SC > 2006_12_31 982616 ACINDAR 'B' DEAD - DELIST.29/01/09 Argentina 1 SC > 2006_12_31 884387 ALTO PALERMO 'B' Argentina 0 SC > 2006_12_31 134841 METROGAS 'B' Argentina 1 SC > 2006_12_31 992126 IMPORT&EXPORT PATAG.'B' Argentina 0 SC > 2006_12_31 677414 GAS NATURAL 'B' Argentina 1 SC > 2006_12_31 151203 CAPEX 'A' Argentina 1 SC > 2006_12_31 322652 BOLDT 'B' Argentina 1 SC > 2006_12_31 255169 CAMUZZI GAS PAMPEANA 'B' Argentina 1 SC > 2006_12_31 134627 ENDESA COSTANERA 'B' Argentina 1 SC > 2006_12_31 134645 CENTRAL PUERTO 'B' Argentina 1 SC > 2006_12_31 320158 CELULOSA 'B' Argentina 1 SC > 2006_12_31 982620 ALPARGATAS Argentina 1 SC > 2006_12_31 982904 RIGOLLEAU 'B' Argentina 1 SC > 2006_12_31 689402 SAN LORENZO 'B' Argentina 1 SC > 2006_12_31 982655 CARLOS CASADO 'B' Argentina 1 SC > 2006_12_31 982933 FERRUM 'B' Argentina 0 SC > 2006_12_31 286752 DISB.DE GAS CUYANA 'B' Argentina 1 SC > 2006_12_31 151196 MIRGOR 'C' Argentina 1 SC > 2006_12_31 50923T TSPA.DE GS.DEL NORTE 'C' Argentina 0 SC > 2006_12_31 286047 GPO.CONCIO.DEL OESTE 'B' Argentina 0 SC > 2006_12_31 322664 CARBOCLOR 'B' Argentina 1 SC > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.