Dear R-Experts,
Since Monday I try to write the right if/else construct for the program.
I was not successful yet. Important is the order of the if-cases! The
code is running with the 2 if-cases. An if/else construction would look
better, so can any one help me with the right if/else construction?
Thanks, Corinna
Program:
--------
userInput <- function() {
print("")
ANSWER <- readline("Should the current workspace of R be deleted
(y/n)? ")
print(ANSWER)
ANSWER
}
deletingDecision = userInput()
yes <- c("y")
no <- c("n")
noAnswer <- c("Current R workspace was not deleted!")
# first if
if (deletingDecision == no) {
print("Current R workspace was not deleted!")
}
# second if
if (deletingDecision == yes) {
rm(list=ls(all=TRUE))
print("Current R workspace was deleted!")
}
______________________________________________
[EMAIL PROTECTED] 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.