Constructing and modifying lists



next up previous contents
Next: Concatenating lists Up: Listsdata frames, Previous: Lists

Constructing and modifying lists

New lists may be formed from existing objects by the function list(). An assignment of the form

St <- list( name=object, name=object, ...,name=object )

sets up a list St of components using comp, ..., comp for the components and giving them names as specified by the argument names, (which can be freely chosen). If these names are omitted, the components are numbered only. The components used to form the list are copied when forming the new list and the originals are not affected.

Lists, like any subscripted object, can be extended by specifying additional components. For example

St[5] <- list(matrix=Mat)





Erik Moledor
Tue Jan 31 21:02:18 EST 1995