Print string and variable contents on the same line in 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.


Answers:


You can use paste with print

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

or cat

cat("Current working dir: ", wd)