Hello Thomas, Ulrik,

thanks for your suggestions.


Giovanni

On Fri, Aug 4, 2017 at 12:13 PM, Thomas Mailund
<thomas.mail...@gmail.com> wrote:
> Do you mean like this?
>
>
>> f <- function(foo, bar) {
> +   result <- list(bar)
> +   names(result) <- foo
> +   result
> + }
>
>> (x <- f("hello", "world"))
> $hello
> [1] "world"
>
>> names(x)
> [1] "hello"

On Fri, Aug 4, 2017 at 12:14 PM, Ulrik Stervbo <ulrik.ster...@gmail.com> wrote:
> Hi Giovani,
>
> I would create an unnamed list and set the names after.
>
> Best,
> Ulrik

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.

Reply via email to