-6ren"> -如果我输入 print(cat("")) 我得到 NULL 我想用cat()打印出 R 脚本的进度,但我不明白为什么它返回 NULL在我所有连接字符串的末尾,更重要的是,如何让它停止? 最佳答案 您的-6ren">
gpt4 book ai didi

r - 在 R 中,我可以停止 print(cat ("")) 返回 NULL 吗?为什么 cat ("foo") 返回 foo>

转载 作者:行者123 更新时间:2023-12-03 13:22:18 25 4
gpt4 key购买 nike

如果我输入

print(cat(""))

我得到
NULL

我想用 cat()打印出 R 脚本的进度,但我不明白为什么它返回 NULL在我所有连接字符串的末尾,更重要的是,如何让它停止?

最佳答案

您的所有答案都在 ?cat 的文档中.回答您的具体问题的部分是:

Arguments:

fill: a logical or (positive) numeric controlling how the output is
broken into successive lines. If ‘FALSE’ (default), only
newlines created explicitly by ‘"\n"’ are printed.
Otherwise, the output is broken into lines with print width
equal to the option ‘width’ if ‘fill’ is ‘TRUE’, or the value
of ‘fill’ if this is numeric. Non-positive ‘fill’ values
are ignored, with a warning.


... 和 ...

Value:

 None (invisible ‘NULL’).


所以你停不下来 print(cat(...))从返回 NULL因为这就是 cat返回。并且您需要明确添加换行符,例如 cat("foo\n") .

关于r - 在 R 中,我可以停止 print(cat ("")) 返回 NULL 吗?为什么 cat ("foo") 返回 foo>,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4055762/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com