寫一條尊重線寬的消息
用法
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。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。