在 R 中的同一行上打印字符串和变量内容 [英] Print string and variable contents on the same line in R

查看:46
本文介绍了在 R 中的同一行上打印字符串和变量内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法在同一行打印文本和变量内容?例如,

Is there a way to print text and variable contents on the same line? For example,

wd <- getwd()
print("Current working dir: ", wd)

我找不到任何有关允许我执行此操作的语法的信息.

I couldn't find anything about the syntax that would allow me to do this.

推荐答案

您可以使用 pasteprint

print(paste0("Current working dir: ", wd))

cat

cat("Current working dir: ", wd)

这篇关于在 R 中的同一行上打印字符串和变量内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆