Dear Contributors I am asking some advice on how to solve the following problem. I have a list composed of 78 elements, each of which is a matrix of factors and numbers, similar to the following bank_name date px_last_CIB Q.Y p_made p_for 1 CIB 10/02/06 1.33 p406-q406 406 406 2 CIB 10/23/06 1.28 p406-q406 406 406 3 CIB 11/22/06 1.28 p406-q406 406 406 4 CIB 10/02/06 1.35 p406-q107 406 107 5 CIB 10/23/06 1.32 p406-q107 406 107 6 CIB 11/22/06 1.32 p406-q107 406 107 -- Francesca ---------------------------------- Francesca Pancotto, PhD Università di Modena e Reggio Emilia Viale A. Allegri, 9 40121 Reggio Emilia Office: +39 0522 523264 Web: https://sites.google.com/site/francescapancotto/ ---------------------------------- [[alternative HTML version deleted]]
Dear Contributors sorry but the message was sent involuntary. I am asking some advice on how to solve the following problem. I have a list composed of 78 elements, each of which is a matrix of factors and numbers, similar to the following bank_name date px_last_CIB Q.Y p_made p_for 1 CIB 10/02/06 1.33 p406-q406 406 406 2 CIB 10/23/06 1.28 p406-q406 406 406 3 CIB 11/22/06 1.28 p406-q406 406 406 4 CIB 10/02/06 1.35 p406-q107 406 107 5 CIB 10/23/06 1.32 p406-q107 406 107 6 CIB 11/22/06 1.32 p406-q107 406 107 Each of these matrixes changes for the column name bank_name and for the suffix _CIB which reports the name as in bank_name. Moreover each matrix as a different number of rows, so that I cannot transform it into a large matrix. I need to create a matrix made of the rows of each element of the list that respect the criterium that the column p_made is = to 406. I need to pick each of the elements of each matrix that is contained in the list elements, that satisfy this condition. It seems difficult to me but perhaps is super easy. Thanks for any help you can provide. Francesca On 4 February 2014 12:42, Francesca <francesca.pancotto@gmail.com> wrote:> Dear Contributors > I am asking some advice on how to solve the following problem. > I have a list composed of 78 elements, each of which is a matrix of > factors and numbers, similar to the following > > bank_name date px_last_CIB Q.Y p_made p_for > 1 CIB 10/02/06 1.33 p406-q406 406 406 > 2 CIB 10/23/06 1.28 p406-q406 406 406 > 3 CIB 11/22/06 1.28 p406-q406 406 406 > 4 CIB 10/02/06 1.35 p406-q107 406 107 > 5 CIB 10/23/06 1.32 p406-q107 406 107 > 6 CIB 11/22/06 1.32 p406-q107 406 107 > > > -- > > Francesca > > ---------------------------------- > Francesca Pancotto, PhD > Università di Modena e Reggio Emilia > Viale A. Allegri, 9 > 40121 Reggio Emilia > Office: +39 0522 523264 > Web: https://sites.google.com/site/francescapancotto/ > ---------------------------------- >-- Francesca ---------------------------------- Francesca Pancotto, PhD Università di Modena e Reggio Emilia Viale A. Allegri, 9 40121 Reggio Emilia Office: +39 0522 523264 Web: https://sites.google.com/site/francescapancotto/ ---------------------------------- [[alternative HTML version deleted]]
Hi, Try: If `lst1` is the list: do.call(rbind,lapply(lst1,function(x) x[x[,"p_made"]==406,])) A.K. On Tuesday, February 4, 2014 8:53 AM, Francesca <francesca.pancotto at gmail.com> wrote: Dear Contributors sorry but the message was sent involuntary. I am asking some advice on how to solve the following problem. I have a list composed of 78 elements, each of which is a matrix of factors and numbers, similar to the following bank_name? date px_last_CIB? ? ? Q.Y? ? p_made p_for 1? ? ? CIB 10/02/06? ? ? ? 1.33 p406-q406? ? 406? ? 406 2? ? ? CIB 10/23/06? ? ? ? 1.28 p406-q406? ? 406? ? 406 3? ? ? CIB 11/22/06? ? ? ? 1.28 p406-q406? ? 406? ? 406 4? ? ? CIB 10/02/06? ? ? ? 1.35 p406-q107? ? 406? ? 107 5? ? ? CIB 10/23/06? ? ? ? 1.32 p406-q107? ? 406? ? 107 6? ? ? CIB 11/22/06? ? ? ? 1.32 p406-q107? ? 406? ? 107 Each of these matrixes changes for the column name bank_name and for the suffix _CIB which reports the name as in bank_name. Moreover each matrix as a different number of rows, so that I cannot transform it into a large matrix. I need to create a matrix made of the rows of each element of the list that respect the criterium that the column p_made is = to 406. I need to pick each of the elements of each matrix that is contained in the list elements, that satisfy this condition. It seems difficult to me but perhaps is super easy. Thanks for any help you can provide. Francesca On 4 February 2014 12:42, Francesca <francesca.pancotto at gmail.com> wrote:> Dear Contributors > I am asking some advice on how to solve the following problem. > I have a list composed of 78 elements, each of which is a matrix of > factors and numbers, similar to the following > > bank_name? date px_last_CIB? ? ? Q.Y? ? p_made p_for > 1? ? ? CIB 10/02/06? ? ? ? 1.33 p406-q406? ? 406? ? 406 > 2? ? ? CIB 10/23/06? ? ? ? 1.28 p406-q406? ? 406? ? 406 > 3? ? ? CIB 11/22/06? ? ? ? 1.28 p406-q406? ? 406? ? 406 > 4? ? ? CIB 10/02/06? ? ? ? 1.35 p406-q107? ? 406? ? 107 > 5? ? ? CIB 10/23/06? ? ? ? 1.32 p406-q107? ? 406? ? 107 > 6? ? ? CIB 11/22/06? ? ? ? 1.32 p406-q107? ? 406? ? 107 > > > -- > > Francesca > > ---------------------------------- > Francesca Pancotto, PhD > Universit? di Modena e Reggio Emilia > Viale A. Allegri, 9 > 40121 Reggio Emilia > Office: +39 0522 523264 > Web: https://sites.google.com/site/francescapancotto/> ---------------------------------- >-- Francesca ---------------------------------- Francesca Pancotto, PhD Universit? di Modena e Reggio Emilia Viale A. Allegri, 9 40121 Reggio Emilia Office: +39 0522 523264 Web: https://sites.google.com/site/francescapancotto/ ---------------------------------- ??? [[alternative HTML version deleted]] ______________________________________________ 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.