Pretty print formatting for lists and vectors
Arguments
- x
list of items to print. All entries must be named and have
as.character()
methods- pre
character. Optional characters to place at the head of each line
Examples
print_list(list())
#> <empty>
#>
print_list(c())
#> <empty>
#>
testvec <- seq(3)
names(testvec) <- LETTERS[seq(3)]
print_list(testvec)
#> A : 1
#> B : 2
#> C : 3
test <- list(
name1 = "1",
longername2 = "test_char",
thirdname = factor("this will be converted with as.character()")
)
print_list(test)
#> name1 : 1
#> longername2 : test_char
#> thirdname : this will be converted with as.character()
print_list(test, pre = "* ")
#> * name1 : 1
#> * longername2 : test_char
#> * thirdname : this will be converted with as.character()