写一条尊重线宽的消息
用法
message_wrap(
x,
width = options()$width - 2,
prefix = "",
color_text = NULL,
color_prefix = color_text
)
参数
- x
-
消息文本的字符串。
- width
-
宽度的整数。
- prefix
-
位于消息第一行的可选字符串。
- color_text, color_prefix
-
用于为文本和/或前缀着色的函数(或
NULL
)。
例子
library(cli)
Gaiman <-
paste(
'"Good point." Bod was pleased with himself, and glad he had thought of',
"asking the poet for advice. Really, he thought, if you couldn't trust a",
"poet to offer sensible advice, who could you trust?",
collapse = ""
)
message_wrap(Gaiman)
#> "Good point." Bod was pleased with himself, and glad he had thought of
#> asking the poet for advice. Really, he thought, if you couldn't trust
#> a poet to offer sensible advice, who could you trust?
message_wrap(Gaiman, width = 20, prefix = "-")
#> - "Good point." Bod
#> was pleased with
#> himself, and glad
#> he had thought of
#> asking the poet
#> for advice.
#> Really, he
#> thought, if you
#> couldn't trust a
#> poet to offer
#> sensible advice,
#> who could you
#> trust?
message_wrap(Gaiman,
width = 30, prefix = "-",
color_text = cli::col_silver
)
#> - "Good point." Bod was
#> pleased with himself, and
#> glad he had thought of
#> asking the poet for advice.
#> Really, he thought, if you
#> couldn't trust a poet to
#> offer sensible advice, who
#> could you trust?
message_wrap(Gaiman,
width = 30, prefix = "-",
color_text = cli::style_underline,
color_prefix = cli::col_green
)
#> - "Good point." Bod was
#> pleased with himself, and
#> glad he had thought of
#> asking the poet for advice.
#> Really, he thought, if you
#> couldn't trust a poet to
#> offer sensible advice, who
#> could you trust?
相关用法
- R tune merge.recipe 将参数网格值合并到对象中
- R tune coord_obs_pred 对观察值与预测值的绘图使用相同的比例
- R tune extract-tune 提取调整对象的元素
- R tune filter_parameters 删除一些调整参数结果
- R tune fit_best 将模型拟合到数值最优配置
- R tune conf_mat_resampled 计算重采样的平均混淆矩阵
- R tune finalize_model 将最终参数拼接到对象中
- R tune tune_bayes 模型参数的贝叶斯优化。
- R tune collect_predictions 获取并格式化由调整函数产生的结果
- R tune show_best 研究最佳调整参数
- R tune expo_decay 指数衰减函数
- R tune fit_resamples 通过重采样拟合多个模型
- R tune autoplot.tune_results 绘图调整搜索结果
- R tune tune_grid 通过网格搜索进行模型调整
- R tune dot-use_case_weights_with_yardstick 确定案例权重是否应传递至标准
- R tune prob_improve 用于对参数组合进行评分的获取函数
- R tune last_fit 将最终的最佳模型拟合到训练集并评估测试集
- R update_PACKAGES 更新现有的 PACKAGES 文件
- R textrecipes tokenlist 创建令牌对象
- R themis smotenc SMOTENC算法
- R print.via.format 打印实用程序
- R tibble tibble 构建 DataFrame 架
- R tidyr separate_rows 将折叠的列分成多行
- R textrecipes step_lemma 标记变量的词形还原
- R textrecipes show_tokens 显示配方的令牌输出
注:本文由纯净天空筛选整理自Max Kuhn等大神的英文原创作品 Write a message that respects the line width。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。