There are many formatting or pretty printing functions available,
some of them quite elaborate. Mine uses only functions in base
. It seems that many
programmers don't realize the power of strwrap
and the sep
parameter for cat
.
An indented, wrapped list styled after a definition.
fl(x, label = "", indent_string = NA) flp(x, label = "", indent_string = NA)
toString
must be able to evaluate it.indent_string
and
`label`.tab.width
option number of spaces. If you wanted your
list indented 4 spaces, pass a string of 4 spaces to this parameter.a formatted string
flp
: formatted string variant
Turns out the tab.width
option is not set by default in base R as
I discovered when I tried to build the package. Now explicitly test to see if the
option is set.
fl(search(), label = "search(): ")#> search(): .GlobalEnv, package:dgutils, devtools_shims, package:pkgdown, #> tools:rstudio, package:stats, package:graphics, package:grDevices, #> package:utils, package:datasets, package:ggplot2, #> package:devtools, package:methods, Autoloads, package:bases <- flp(search(), label = "search(): ")