Dear all, I am looking for some procedure to send inputs to a function
interactively. Here is an example:

fn1 <- function(x = 10) {
y <- 0
# ask user whether he wants to put some other value for "y"
# R will show 2 options: 1. y = 2
#                                  2. y = 3
# user will choose either options 1 or 2
# once user is done, function will over-write the existing value of y,
with say, option 2. Therefore current value of y is 2. Then R will
continue calculation
return(x*y)
}

Here obviously I can put "y" as the 2nd input of fn1(), however I want
to do so interactively.

Can friends here direct me how to do that?

Thanks,

______________________________________________
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.

Reply via email to