How can I print string and variable contents on the same line using R?

0 votes
May 9, 2018 in Data Analytics by shams
• 3,580 points
22 views

1 answer to this question.

0 votes

There are two options for doing so. 

  • You can use paste with print: print(paste0("word document: ", wd))
  • You can use cat: cat("word document: ", wd)

In both the above cases you will get the string as well as your variable content.

 

answered May 9, 2018 by zombie
• 3,690 points

Related Questions In Data Analytics

0 votes
1 answer

How can I figure out if an R program was executed from the command line?

Try this code: if (interactive()) { print('Hello ...READ MORE

answered Jun 28 in Data Analytics by Zulaikha
• 720 points
14 views
0 votes
1 answer

Which function can I use to clear the console in R and RStudio ?

Description                   Windows & Linux           Mac Clear console                      Ctrl+L ...READ MORE

answered Apr 17, 2018 in Data Analytics by anonymous
902 views
0 votes
1 answer

How can I control the size of points in an R scatterplot?

plot(variable, type='o' , pch=5, cex=.3) The pch argument ...READ MORE

answered May 3, 2018 in Data Analytics by shams
• 3,580 points
23 views
0 votes
1 answer

What is a Random Walk model and how can you simulate it using R?

A random walk is a simple example ...READ MORE

answered Jul 3, 2018 in Data Analytics by DataKing99
• 8,100 points
392 views
0 votes
1 answer

How can I import a file in R without giving the destination/file path to the specified file?

You can use the window explorer to ...READ MORE

answered Aug 28, 2018 in Data Analytics by ANMOL
• 3,620 points

edited Aug 28, 2018 by Vardhan 33 views
0 votes
1 answer

How can I convert a factor variable to numeric in R ?

A factor variable can be converted to ...READ MORE

answered Sep 18, 2018 in Data Analytics by shams
• 3,580 points
28 views
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

How can I increase the number of axis ticks in R ?

You can try to override ggplots default ...READ MORE

answered May 30, 2018 in Data Analytics by zombie
• 3,690 points
158 views
0 votes
1 answer

How can I list all the data sets available in all R packages?

You can use the below line of ...READ MORE

answered Sep 7, 2018 in Data Analytics by zombie
• 3,690 points
28 views