R/menuA.R

menuA<-function (choices, stInd, showLine) 
{
  ## written by Dr. Jie Hao, Imperial College London
  ## menue function, for internal use
  nc <- length(choices)
  cat(showLine)
  cat(as.character(choices))
  
  ind <- 0
  while (ind < 1 || ind > 3){
   ind <- readline("\nSelection: ")
   #ind<- scan(n=1, quiet = TRUE)
   #ind <- as.integer(ind)
    ind <- ifelse(grepl("\\D",ind),-1,as.integer(ind))
    #if(is.na(ind)){break}  # breaks when hit enter
  }
  return(ind)

}

Try the batman package in your browser

Any scripts or data that you put into this service are public.

batman documentation built on May 2, 2019, 6:13 p.m.