Skip to contents

Convenience wrapper around as_chr() and base::cat(), mainly intended for interactive use.

Usage

cat_lines(...)

Arguments

...

R object(s) to convert to character and print. Dynamic dots are supported.

Value

None (invisible NULL).

See also

cli::cat_line() for a faster alternative that doesn't recursively convert its input to type character.

xfun::raw_string() (and xfun::file_string()) for an alternative approach to the same use case (but without any conversion to type character at all).

Examples

fs::path_package(package = "pal",
                 "rstudio", "addins.dcf") |>
  readr::read_lines() |>
  pal::cat_lines()
#> Name: Build `README.Rmd`
#> Description: Executes `pal::build_readme()`.
#> Binding: build_readme
#> Interactive: false

# conversion to type character, recursive vs. non-recursive
to_convert <- list(tibble::tibble(a = 1:3), "A", factor("wonderful"), xfun::strict_list("day"))

to_convert |> pal::cat_lines()
#> 1
#> 2
#> 3
#> A
#> wonderful
#> day
to_convert |> cli::cat_line()
#> list(a = 1:3)
#> A
#> 1
#> list("day")