[英]Where is this space coming from in cat()
If i run: 如果我运行:
r_2 = 0.89 # (wow that's an impressive R^2)
rmse = 24724.58
cat("R^2: ", r_2, '\n',"RMSE: ", rmse)
in the RStudio Console it returns: 在RStudio控制台中,它返回:
R^2: 0.89
RMSE: 24724.58
is it obvious why there's an extra space before RMSE
? 很明显,为什么在
RMSE
之前还有多余的空间?
Yes, that's due to the sep
argument of cat
: 是的,这是由于
cat
的sep
参数:
sep - a character vector of strings to append after each element.
sep-在每个元素后附加的字符串的字符向量。
cat("R^2: ", r_2, '\n', "RMSE: ", rmse, sep = "")
# R^2: 0.89
# RMSE: 24724.58
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.