Re: [R] Managing list elements

From: Phil Spector <spector_at_stat.berkeley.edu>
Date: Fri, 11 Jun 2010 10:36:32 -0700 (PDT)

Luis -

    I *think* that

mapply(list,LHS,RHS,SIMPLIFY=FALSE)

will give you what you want, but without a reproducible example it's hard to tell.

On Fri, 11 Jun 2010, Luis Felipe Parra wrote:

> Hello, I have two lists with the same number of elements
>
>> tail(LHS)
> [[1]]
> [1] "antecedentes.factor_riesgo=17" "antecedentes.estado=1"
> "antecedentes.medio=4" "tarjetas_flagrancia.adquiriente2="
> [[2]]
> [1] "antecedentes.riesgo=1" "antecedentes.estado=1"
> "antecedentes.medio=4" "tarjetas_flagrancia.adquiriente2="
> [[3]]
> [1] "resultado_investig.pto_comp=N" "antecedentes.riesgo=1"
> "antecedentes.factor_riesgo=17" "antecedentes.medio=4"
> [[4]]
> [1] "resultado_investig.pto_comp=N" "antecedentes.riesgo=1"
> "antecedentes.factor_riesgo=17" "tarjetas_flagrancia.adquiriente2="
> [[5]]
> [1] "resultado_investig.pto_comp=N" "antecedentes.factor_riesgo=17"
> "antecedentes.medio=4" "tarjetas_flagrancia.adquiriente2="
> [[6]]
> [1] "resultado_investig.pto_comp=N" "antecedentes.riesgo=1"
> "antecedentes.medio=4" "tarjetas_flagrancia.adquiriente2="
>> tail(RHS)
> [[1]]
> [1] "antecedentes.riesgo=1"
> [[2]]
> [1] "antecedentes.factor_riesgo=17"
> [[3]]
> [1] "tarjetas_flagrancia.adquiriente2="
> [[4]]
> [1] "antecedentes.medio=4"
> [[5]]
> [1] "antecedentes.riesgo=1"
> [[6]]
> [1] "antecedentes.factor_riesgo=17"
>>
>
>
> I would like to create a new list from this two which would have in every
> list entry one entry with the corresponding elements from LHS and another
> entry with the corresponding element from RHS (LHS doesn't always have three
> 4 elements per entry). Do you know how can I do this? Thank you
>
> Felipe Parra
>
> [[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.
>



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. Received on Fri 11 Jun 2010 - 17:38:45 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 11 Jun 2010 - 19:00:29 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive