Skip to contents

Make sure the object is a list

Usage

toList(object)

Arguments

object

Object to be converted to a list.

Value

If is.list(object) == TRUE, returns the object; otherwise, list(object).

Examples

toList(list("a" = 1, "b" = 2))
#> $a
#> [1] 1
#> 
#> $b
#> [1] 2
#> 
toList(c("a" = 1, "b" = 2))
#> [[1]]
#> a b 
#> 1 2 
#>