[R] define a list with names as variables

Giovanni Gherdovich g.gherdovich at gmail.com
Fri Aug 4 17:34:31 CEST 2017


On Fri, Aug 4, 2017 at 4:25 PM, Bert Gunter <bgunter.4567 at gmail.com> wrote:
>> f <- function(foo,bar) structure(list(bar),names =foo)
>
>> f("hello","world")
> $hello
> [1] "world"
>
> Cheers,
> Bert

Thanks Bert, I didn't know about "structure()".

Giovanni



More information about the R-help mailing list