Ask                   package:car                   R Documentation

_C_h_a_n_g_e _A_r_g_u_m_e_n_t _t_o _a _F_u_n_c_t_i_o_n _I_n_t_e_r_a_c_t_i_v_e_l_y

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

     `Ask' allows you to change the argument to a function
     interactively.
 It is meant to be used, in lieu of a graphical
     control such as a slidebar,
 to adjust plotting parameters, which
     are
 most naturally passed as the argument to an anonymous
     function that sets
 up the plot.

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


     Ask(arg, fun, ...)

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

     arg: argument to `fun' to change. By specifying a vector of
          values,
 you can change several parameters via an argument to
          an anonymous function.

     fun: function to call; often an anonymous function that sets up
 a
          call to plotting functions.

     ...: other arguments to `fun'; not necessary if `fun'
 is an
          anonymous function.

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

     `Ask' repeatedly prompts in the R Console for the value of `arg'.
     To exit, enter a blank line.

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

     `Ask' returns invisibly the value of the last call to `fun';
     usually this will be `NULL', and in any event is probably not of
     interest. If it is, use `print(Ask(arg, fun, ...))'.

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

     John Fox jfox@mcmaster.ca

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



     data(UN)
     attach(UN)

     # enter the power-transformation parameter
     # start with 1
     Ask(p, function(p) qq.plot(box.cox(gdp, p), 
             ylab=paste("transformed gdp, power =",p)))

     # enter an expression that evaluates to a 2-vector
     # of powers; e.g., start with c(1,1); then interactively
     # identify points in each plot
     Ask(p, function(p) scatterplot(box.cox(gdp,p[1]), 
         box.cox(infant.mortality, p[2]), 
         xlab=paste("transformed GDP/capita, power =",p[1]),
         ylab=paste("transformed infant mortality, power =",p[2]),
         labels=rownames(UN)))    


