Print string and variable contents on the same line in R

前端 未结 8 1483
梦谈多话
梦谈多话 2020-12-07 07:35

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

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

I c

相关标签:
8条回答
  • 2020-12-07 08:15

    you can use paste0 or cat method to combine string with variable values in R

    For Example:

    paste0("Value of A : ", a)
    
    cat("Value of A : ", a)
    
    0 讨论(0)
  • 2020-12-07 08:21

    You can use paste with print

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

    or cat

    cat("Current working dir: ", wd)
    
    0 讨论(0)
提交回复
热议问题