r - Unpacking a vector into a list with each element of vector as separate elements in list -


with following code, creating list:

scales <- c(p="hye", r="t3") details <- list(t=20,y="c", scales) 

at moment above gives me list so:

$t [1] 20  $y   [1] "c"  [[3]] p     r  "hye"  "t3" 

however want list so:

$t [1] 20  $y   [1] "c"  $p       [1] "hye"    $r [1] "t3" 

since going reused in function want keep scales vector argument can insert list. how can this?

the solution is:

details = c(list(t=20,y="c"),scales) 

Comments

Popular posts from this blog

How do you change vbulletin's home page to the forums instead of the default (CMS or Activity Stream)? -

c++ - Troubles when compiling phash program -