If you want to start learning the R programming or you have a bit knowledge about R programming, then this tutorial will help you to explore more. In this tutorial, we are going to share a R program to take input from user with an example.
Try more:
Copy the below code and execute it to see the program output.
1 2 3 4 5 | my.name <- readline(prompt="Enter name: ") my.age <- readline(prompt="Enter age: ") my.age <- as.integer(my.age) print(paste("Hi,", my.name, "next year you will be", my.age+1, "years old.")) |
Enter name: Prem
Enter age: 29
Hi, Prem next year you will be 29 years old.
If you like FreeWebMentor and you would like to contribute, you can write an article and mail your article to [email protected] Your article will appear on the FreeWebMentor main page and help other developers.