#5, First Floor, 4th Street , Dr. Subbarayan Nagar Kodambakkam, Chennai-600 024 pro@slogix.in

Office Address

  • #5, First Floor, 4th Street Dr. Subbarayan Nagar Kodambakkam, Chennai-600 024 Landmark : Samiyar Madam
  • pro@slogix.in
  • +91- 81240 01111

Social List

How to get User Input in R?
Description

To get the user input using R programming.

Process

   R Function : readLine() or readLines()

Sapmle Code

#How to get User Input

name<-readline(prompt = “Enter Your Name : “)
age<-readline(prompt = “Enter Your Age : “)
val<-18-as.integer(age) if(age>=18)
{
cat(“Hello”,name,”You are eligible for voting :)”)
}else
{
cat(“Oops!!!”,name,”You are not eligible for voting \n You need”,val,”more years for voting”)
}

Screenshots