Ff Yy
Ff Yy

Reputation: 247

In R is there some function like raw_input() in python?

In Python, we can use raw_input(), what can I use in R?

>>> raw_input("let x=3 or 4?")
let x=3 or 4?3
'3'

Upvotes: 2

Views: 4766

Answers (3)

Dragos Bandur
Dragos Bandur

Reputation: 301

... even more python-ish:

(readline(prompt = 'Enter anything: '))

Upvotes: 0

Baga
Baga

Reputation: 31

Here is a better solution:

input = readline(prompt="Enter anything: ")

This will will work in a interactive session

Upvotes: 3

daedalus
daedalus

Reputation: 10923

Try readline():

> input = readline('Enter anything: ')
Enter anything: test
> input
[1] "test"
> 

Upvotes: 8

Related Questions