Make a List from a Parameter Specification
make.par.list.RdProcess parameters so that a list of parameter
specifications is returned (used by plot.zoo and
xyplot.zoo).
Usage
make.par.list(nams, x, n, m, def, recycle = sum(unnamed) > 0)Arguments
- nams
character vector with names of variables.
- x
list or vector of parameter specifications, see details.
- n
numeric, number of rows.
- m
numeric, number of columns. (Only determines whether
mis 1 or greater than 1.- def
default parameter value.
- recycle
logical. If
TRUErecycle columns to provide unspecified ones. IfFALSEusedefto provide unspecified ones. This only applies to entire columns. Within columns recycling is always done regardless of howrecycleis set. Defaults toTRUEif there is at least one unnamed variable and defaults toFALSEif there are only named variables inx.
Details
This function is currently intended for internal use. It is currently
used by
plot.zoo and xyplot.zoo but might also be used in the future
to create additional new plotting routines.
It creates a new list which uses the named variables from x
and then assigns the unnamed in order. For the remaining variables
assign them the default value if !recycle or recycle the
unnamed variables if recycle.
Examples
make.par.list(letters[1:5], 1:5, 3, 5)
#> $a
#> [1] 1
#>
#> $b
#> [1] 2
#>
#> $c
#> [1] 3
#>
#> $d
#> [1] 4
#>
#> $e
#> [1] 5
#>
suppressWarnings( make.par.list(letters[1:5], 1:4, 3, 5, 99) )
#> $a
#> [1] 1
#>
#> $b
#> [1] 2
#>
#> $c
#> [1] 3
#>
#> $d
#> [1] 4
#>
#> $e
#> [1] 1
#>
make.par.list(letters[1:5], c(d=3), 3, 5, 99)
#> $a
#> [1] 99
#>
#> $b
#> [1] 99
#>
#> $c
#> [1] 99
#>
#> $d
#> [1] 3
#>
#> $e
#> [1] 99
#>
make.par.list(letters[1:5], list(d=1:2, 99), 3, 5)
#> $a
#> [1] 99
#>
#> $b
#> [1] 99
#>
#> $c
#> [1] 99
#>
#> $d
#> [1] 1 2 1
#>
#> $e
#> [1] 99
#>
make.par.list(letters[1:5], list(d=1:2, 99, 100), 3, 5)
#> $a
#> [1] 99
#>
#> $b
#> [1] 100
#>
#> $c
#> [1] 99
#>
#> $d
#> [1] 1 2 1
#>
#> $e
#> [1] 100
#>