Is this what you would expect to have. Definitely you can make this function more elegant:
fn1 <- function(x = 10) { cat("Please type the option number to get your Y value:\n\n") cat(" 1. Y = 1.\n 2. Y = 2.\n 3. Use the default y.\n 4. Choose my own value for y.\n\n") opt=scan() if (opt==3) y <-0 else if (opt==4) { cat("Please type your Y value:\n\n") y=scan() } else y = opt return(x*y) } -- View this message in context: http://r.789695.n4.nabble.com/Supplying-function-inputs-interactively-tp2536003p2536012.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.