

readline {base}                              R Documentation

_R_e_a_d _a _L_i_n_e _f_r_o_m _t_h_e _T_e_r_m_i_n_a_l

_D_e_s_c_r_i_p_t_i_o_n_:

     `readline' reads a line from the terminal, returning it
     as a character string.

_U_s_a_g_e_:

     readline(prompt="")

_A_r_g_u_m_e_n_t_s_:

  prompt: the string printed when prompting the user for
          input.  Should usually end with a space `" "'.

_E_x_a_m_p_l_e_s_:

     fun <- function() {
       ANSWER <- readline("Are you a satisfied R user? ")
       if (substr(ANSWER, 1, 1) == "n")
         cat("This is impossible.  YOU LIED!\n")
       else
         cat("I knew it.\n")
     }
     fun()

