How to ask for user input in R in an online IDE?

时间:2018-12-03 12:54:54

标签: r input ide user-input stdin

I'm preparing an online tutorial page that does code evaluation using pre-fed tests. I'm trying to write a simple program in an online ide environment and readline(prompt="") does not work.

Can anyone suggest what needs to be modified for online environment? link to online code: jdoodle.com/a/PzU

for reference: code is

x <- 10
y <- 25
z <- sum(x,y)
p <- readline(prompt="enter val:")
cat("x + y = ", z)
cat(p)
cat("\nterminate")

output is:

enter val:
x + y =  35
terminate

desired output:

enter val:
[reads input value: "3"]
x + y =  35
3
terminate

0 个答案:

没有答案
相关问题