Learn R Programming

bbmle (version 1.0.25.1)

relist2: reconstruct the structure of a list

Description

reshapes a vector according to a list template

Usage

relist2(v, l)

Value

a list with values corresponding to v and structure corresponding to l

Arguments

v

vector, probably numeric, of values to reshape

l

template list giving structure

Author

Ben Bolker

Details

attempts to coerce v into a list with the same structure and names as l

Examples

Run this code
  l = list(b=1,c=2:5,d=matrix(1:4,nrow=2))
  relist2(1:9,l)

Run the code above in your browser using DataLab