Skip to content
Prev 33465 / 63424 Next

can a key of a list be a variable

Patterns like these can help to do what you want:

 > lapply(setNames(1:3, paste("step", 1:3, sep="")), function(i) seq(i))
$step1
[1] 1

$step2
[1] 1 2

$step3
[1] 1 2 3

 > setNames(list("the result"), paste("a", "name"))
$`a name`
[1] "the result"

 >

-- Tony Plate
Bilel MASMOUDI wrote: