Adds breaks to the text of a deparsed data structure script
Source:R/enscript.R
dot-format_script.Rd
Adds breaks to the text of a deparsed data structure script
Arguments
- obj_expr
text for a data structure
- snip_width
limit for the number of characters desired before data folding at comma-space breaks
Examples
letters[1:5] |> deparse1(backtick = TRUE) |> xlr:::.format_script()
#> [1] "c(\"a\", \"b\", \"c\", \"d\", \"e\")"
list(tail(iris,2)) |> deparse1(backtick = TRUE) |> xlr:::.format_script()
#> [1] "list(\nstructure(\nlist(\nSepal.Length = c(\n6.2, 5.9\n), \nSepal.Width = c(\n3.4, 3\n), \nPetal.Length = c(\n5.4, 5.1\n), \nPetal.Width = c(\n2.3, 1.8\n), \nSpecies = structure(\nc(\n3L, 3L\n), \nlevels = c(\n\"setosa\", \"versicolor\", \"virginica\"\n), \nclass = \"factor\"\n)\n), \nrow.names = 149:150, \nclass = \"data.frame\"\n)\n)\n"