Learn R Programming

SpatioTemporal (version 1.1.2)

defaultList: Add Default Elements to Incomplete list

Description

Given two lists elemets (by name) missing from the first are copied from the second list (if present). Is used to create default lists, ensuring that all elements expected in the list are present with reasonable values (if not user specified).

Usage

defaultList(x, prototype = list())

Arguments

x
A list
prototype
A list with named elements, any elements missing from x are replaced with corresponding elements from prototype.

Value

  • Updated version of x

See Also

Other utility functions: convertCharToDate

Examples

Run this code
defaultList(list(a=1,b=4), list(a=3,c="a",d=4))

Run the code above in your browser using DataLab