selectCore             package:goCluster             R Documentation

_A _m_e_n_u _f_u_n_c_t_i_o_n

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

     The function generates a generic menu that will return the choice
     of the user.

_U_s_a_g_e:

     selectCore(message,
     convert = function(X) X,
     check = function(X) TRUE,
     options = NULL,
     optflag = TRUE,
     error = function(X) return("Invalid choice!"),
     ...
     )
     selectCorePlain(message,
     convert = function(X) X,
     check = function(X) TRUE,
     options = NULL,
     optflag = TRUE,
     error = function(X) return("Invalid choice!"),
     ...
     )
     selectCoreTk(message,
     convert = function(X) X,
     check = function(X) TRUE,
     options = NULL,
     optflag = TRUE,
     error = function(X) return("Invalid choice!"),
     ...
     )

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

 message: The informational message that will be shown together with
          the menu.

 convert: A function that converts the user input to a desired format
          or class type.

   check: A function that checks the user input for validity.

 options: The available options as character vector, if any.

 optflag: Is the user allowed to select several options or only one?

   error: The function that should be executed in case of an error.
          This should deliver a message that is useful to the user.

     ...: Additional arguments for the convert, check and error
          functions. 

_D_e_t_a_i_l_s:

     'selectCore' is a function that provides a generic menu. This can
     either be a simple textual menu or a graphical version depending
     on the setting of the option 'goCluster.useTk'. You can use
     'option(goCluster.useTk=1)' to activate the graphical menu.
     'selectCore' will then dispatch the function call to the Tk
     version of the function instead of the textual version. The
     textual menu is the default. The function needs a message that
     should be displayed to the user, a function to convert the user
     input to a desired format and another function to check the
     validity of the user input. Finally a set of options that should
     be displayed to the user as a numbered list can be specified as a
     character vector. If 'convert' is not specified, the user input
     will be used as given (string format) and if 'check' is left
     unspecified, the check will always return TRUE.

_V_a_l_u_e:

     The choice of the user in the format returned by the convert
     function.

_A_u_t_h_o_r(_s):

     Gunnar Wrobel, <URL: http://www.gunnarwrobel.de>.

_S_e_e _A_l_s_o:

     'selectOption', 'selectDouble', 'selectNumber'.

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

     if(interactive()){
     ## This example can only be run in an interactive mode
     option(goCluster.useTk=0)

     selectCore("Please choose a number between 0 and 10",convert=function(X) as.integer(X), check=function(X) (X > 0 & X < 10))

     option(goCluster.useTk=1)

     selectCore("Please choose a number between 0 and 10",convert=function(X) as.integer(X), check=function(X) (X > 0 & X < 10))
     }

