在多行文本上打印单个 tibble 行
Printing a single tibble row over multiple lines of text
有时需要在 tibble
中多行打印一个字符串。示例:https://github.com/ropensci/drake/issues/489. drake
plans 长命令难以阅读。
library(drake)
pkgconfig::set_config("drake::strings_in_dots" = "literals")
drake_plan(
u_auckland = make_place(
Name = "University of Auckland",
Latitude = -36.8521369,
Longitude = 174.7688785
),
shapefile = {
file_out("u-auckland.prj", "u-auckland.shx", "u-auckland.dbf")
st_write(
obj = u_auckland,
dsn = file_out("u-auckland.shp"),
driver = "ESRI Shapefile",
delete_dsn = TRUE
)
}
)
#> # A tibble: 2 x 2
#> target command
#> * <chr> <chr>
#> 1 u_auckland "make_place(Name = \"University of Auckland\", Latitude = -3…
#> 2 shapefile "{\n file_out(\"u-auckland.prj\", \"u-auckland.shx\", \"u…
可以pillar::pillar_shaft()
or a similar tool to achieve something nicer? I am mainly concerned with line breaks and indentation (possibly with styler
) but I am also interested in syntax highlighting, possibly with hightlight
and crayon
.
# A tibble: 2 x 2
target command
* <chr> <drake_cmd>
1 u_auckland make_place(
Name = "University of Auckland",
Latitude = -36.8521369,
Longitude = 174.7688785
)
2 shapefile {
file_out(
"u-auckland.prj",
"u-auckland.shx",
"u-auckland.dbf"
)
st_write(
obj = u_auckland,
dsn = file_out("u-auckland.shp"),
driver = "ESRI Shapefile",
delete_dsn = TRUE
)
}
所以,显然这是 currently not possible as such, but a great workaround 为我的原始用例建议的。
有时需要在 tibble
中多行打印一个字符串。示例:https://github.com/ropensci/drake/issues/489. drake
plans 长命令难以阅读。
library(drake)
pkgconfig::set_config("drake::strings_in_dots" = "literals")
drake_plan(
u_auckland = make_place(
Name = "University of Auckland",
Latitude = -36.8521369,
Longitude = 174.7688785
),
shapefile = {
file_out("u-auckland.prj", "u-auckland.shx", "u-auckland.dbf")
st_write(
obj = u_auckland,
dsn = file_out("u-auckland.shp"),
driver = "ESRI Shapefile",
delete_dsn = TRUE
)
}
)
#> # A tibble: 2 x 2
#> target command
#> * <chr> <chr>
#> 1 u_auckland "make_place(Name = \"University of Auckland\", Latitude = -3…
#> 2 shapefile "{\n file_out(\"u-auckland.prj\", \"u-auckland.shx\", \"u…
可以pillar::pillar_shaft()
or a similar tool to achieve something nicer? I am mainly concerned with line breaks and indentation (possibly with styler
) but I am also interested in syntax highlighting, possibly with hightlight
and crayon
.
# A tibble: 2 x 2
target command
* <chr> <drake_cmd>
1 u_auckland make_place(
Name = "University of Auckland",
Latitude = -36.8521369,
Longitude = 174.7688785
)
2 shapefile {
file_out(
"u-auckland.prj",
"u-auckland.shx",
"u-auckland.dbf"
)
st_write(
obj = u_auckland,
dsn = file_out("u-auckland.shp"),
driver = "ESRI Shapefile",
delete_dsn = TRUE
)
}
所以,显然这是 currently not possible as such, but a great workaround 为我的原始用例建议的。