如何在R中的表达式中使用变量的值? [英] How to use value of variables in expressions in R?

查看:28
本文介绍了如何在R中的表达式中使用变量的值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对 R 比较陌生.如何在打印和其他语句中使用变量的值.例如,在 Java 中我们可以这样做:

I am relatively new to R. How do I use the value of variables in print and other statements. For example, in Java we can do this by:

System.out.println(" My name is "+ pradeep);

我们使用 + 运算符.如何在 R 中做到这一点?

We use the + operator. How to do this in R?

推荐答案

在 R 中,您可以使用 paste() 来做到这一点(有关详细信息,请参阅 ?paste):

In R you can do this with paste() (see ?paste for more info):

print(paste("My name is ", pradeep, ".", sep = ""))

这篇关于如何在R中的表达式中使用变量的值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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