如何在R中的打印函数中添加不同的数据类型?

如何在R中的打印函数中添加不同的数据类型?,r,R,就像我想输出的二加三的和是:5, 那么我该如何加入: ` num1我们可以使用sprintf print(sprintf('The sum of two and three is: %d', num1 + num2)) #[1] "The sum of two and three is: 5" 或粘贴以连接两个字符串 print(paste0("The sum of two and three is: ", num1 + num2)) #[1] &quo

就像我想输出的
二加三的和是:5
, 那么我该如何加入: `


num1我们可以使用
sprintf

print(sprintf('The sum of two and three is: %d', num1 + num2))
#[1] "The sum of two and three is: 5"
或粘贴
以连接两个字符串

print(paste0("The sum of two and three is: ", num1 + num2))
#[1] "The sum of two and three is: 5"
或使用
glue

glue::glue("The sum of two and three is: {num1 + num2}")
#The sum of two and three is: 5

@DikeshShrestha根据您显示的输入,我得到输出并显示该输出
glue::glue("The sum of two and three is: {num1 + num2}")
#The sum of two and three is: 5