Ask {car}R Documentation

Change Argument to a Function Interactively

Description

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.

Usage

Ask(arg, fun, ...)

Arguments

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.

Details

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

Value

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, ...)).

Author(s)

John Fox jfox@mcmaster.ca

Examples

    ## Not run: 
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)))    
    ## End(Not run)

[Package car version 1.1-0 Index]