运行R CMD检查时,打印检查标记正在触发警告
我正在编写一个简单的功能,该功能从用户读取多个文件,然后将其打印到终端(print
)文件名中,如果是有效的/无效的,则是或否。我想使用X/✓
符号。
但是,由于检查符号不在ASCII中,因此R CMD发出警告。我尝试了几种方法(ChartOraw,Inttoutf8,符号(“ \ 326”)
,但NON正在使用终端中的简单打印。 例如:
Df <- data.frame(file = myfiles, status = “x”)
Df$status[1]= “✓”
print (Df)
有什么想法吗?谢谢
I‘m writing a simple function that reads multiple files from the user, then it prints into the terminal (print
) file name and yes or no next to it, if it was valid/invalid. I would like to use x/✓
symbols.
The problem however, since the check symbol is not in ascii, R cmd is throwing a warning. I tried several approaches (charToRaw, intToUtf8, symbol(“\326”)
yet non is working with simple print in terminal.
As an example:
Df <- data.frame(file = myfiles, status = “x”)
Df$status[1]= “✓”
print (Df)
Any idea? Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
cli
软件包提供了一种用cli_alert_success
和cli_alert_danger
打印它们的方法。据推测,您对文件是否有效进行了一些更复杂的检查。将其作为布尔而不是明确的字符存储。The
cli
package offers a way to print these withcli_alert_success
andcli_alert_danger
. Presumably, you have some more complicated check as to if the file was valid. Store that as a boolean instead of the explicit character.