我正在使用for循环生成模型结果并在r markdown中打印它们。为了保持整洁,在打印模型结果之前打印注释会很不错。
有没有办法在R中打印标签后面的注释文本?
e.g。
constructor(platform: Platform, public http: Http) {
this.platform = platform;
this.headers = new Headers();
this.headers.append('Content-Type', 'application/x-www-form-urlencoded');
}
send(subject, body)
{
var body = "subject=" + subject + "&body=" + body;
let result = this.http.post('http://172.16.2.115:3004/message',
body,
{
headers: this.headers
});
console.log(body);
console.log(this._apiUrl);
return result;
}
VS
for(i in c(1:10)){
#this is the number
print(i)}
答案 0 :(得分:0)
在我看来,无需尝试打印评论。您可以在循环中使用cat("this is the number", i, "\n")
。例如:
for (i in 1:5)
cat("this is number", i, "\n")
this is number 1
this is number 2
this is number 3
this is number 4
this is number 5
message
代替cat
,往往是首选,因为我们可以使用suppressMessages
轻松摆脱它们,或者更好,message=FALSE
在knitr / rmarkdown {{3 }}