R: Extract one or more elements from a list

indexList {tractor.base} | R Documentation

## Extract one or more elements from a list

### Description

Given a list-like first argument, this function extracts one or more of its elements. Numeric and character indexing are allowed.

### Usage

    indexList(list, index = NULL)

### Arguments

`list` | A list-like object, with a `[[` indexing method.
`index` | A vector of integers or strings, or `NULL`.

### Value

If `index` is `NULL`, the whole list is returned. Otherwise, if `index` has length one, the corresponding element is extracted and returned. Otherwise a list containing the requested subset is returned.

### Note

This function is not type-safe, in the sense that its return type depends on its arguments. It should therefore be used with care.

### Author(s)

Jon Clayden

### References

Please cite the following reference when using TractoR in your work:

J.D. Clayden, S. Muñoz Maniega, A.J. Storkey, M.D. King, M.E. Bastin & C.A. Clark (2011). TractoR: Magnetic resonance imaging and tractography with R. Journal of Statistical Software 44(8):1-18. http://www.jstatsoft.org/v44/i08/.

[Package tractor.base version 3.2.2 Index]