makeCurrent {CoCoRaw}R Documentation

Move the pointer named CURRENT (BASE) in the CoCo object

Description

Move the internal pointer named CURRENT (BASE) in the list of models in the CoCo object. Values returned from models are by default of the CURRENT model. By default, the CURRENT model is tested against the BASE model.

Usage

makeCurrent(model = "last", silent = TRUE, both = FALSE, push = FALSE,
           data = NULL, object = .object.of.model(model, 
                                                  data = data, ...), ...)
makeBase(model = "current", silent = TRUE, both = FALSE, push = FALSE,
         data = NULL, object = .object.of.model(model, 
                                                data = data, ...), ...)

Arguments

model Numeric, text string, or model object. If numeric then the CURRENT (BASE) pointer is moved to the model with that number (if the model is available). The model number is then returned. The text strings "base", "current", "last", "previous", and "next" will cause the model pointer to be moved to respectively the BASE model, the CURRENT model, the LAST model (model the largest number), the model with the largest number smaller then the number of the CURRENT (BASE) model, and finally the model with the smallest number larger then the number of the CURRENT (BASE) model.
silent Logical: If FALSE then some error messages are printed when the model is not available.
both Logical: If both is TRUE then both pointers (CURRENT and BASE) are moved (in CoCoCg): For "next" and "previous" first the CURRENT (BASE) model of the call is set, and then the other pointer BASE (CURRENT) are moved to the same model.
push Logical: If push is TRUE then both pointers are pushed onto a stack internally in the CoCoCg object - with the ability to restore the pointers by, e.g., the pop argument to returnModelNumber.
data ( See exportCoCo. )
object See exportCoCo.
... ( Additional arguments to generate the CoCo object from the data argument. See propertyModel. )

Details

The model first entered into a CoCo object is both BASE and CURRENT, and is given the number 1. The BASE (first) model stays BASE until another model is declared as BASE. Additional entered models, models created by editModel and models selected in steps of backward and forward are given an increasing number, and inserted into the model list. The model last entered is the CURRENT model. The last model generated by editModel or selected in steps of backward or forward is the LAST model, and can be named CURRENT by makeCurrent(model = "last", ...).

Value

The logical FALSE is returned, if the model is not available, else an integer is returned. If the model argument is an integer or a model object then the model number is returned.

Note

both and push is only implemented for CoCoCg objects.

makeCurrent(model = "previous", ...) at the first model will return FALSE, but makeCurrent(model = "next", ...) at the last model will set the CURRENT to the first model in the model list, and return an integer.

makeCurrent will not accept a text string with the generating class of a model as an argument. (makeCurrent without a CoCo object is irrelevant. )

Author(s)

Jens Henrik Badsberg

References

Badsberg, J.H.: A guide to CoCo, JSS, 2001 ( http://www.jstatsoft.org/v06/i04/ ) and Badsberg, J.H.: Xlisp+CoCo, Aalborg University, 1996.

See Also

enterModel, showModel, returnTest, isSubmodel, propertyModel, returnModel and returnModelNumber.

Examples

library(CoCo);
data(Reinis);
CoCoObject <- makeCoCo();
enterTable(Reinis, object = CoCoObject);

# Enter the saturated model:    
enterModel("*", object = CoCoObject);

# Generate some models, here by "backward":
backward(recursive = TRUE, headlong = TRUE, coherent = TRUE, 
         follow = TRUE, object = CoCoObject);

# Show the model list:
showModel("all", object = CoCoObject);

# Test the last model against the saturated model (the first model):
makeCurrent("last", object = CoCoObject);
showTest(object = CoCoObject);

# "last" is default for makeCurrent:
showModel("all", object = CoCoObject);
makeCurrent(object = CoCoObject);
showModel("all", object = CoCoObject);

# "current" is default for makeBase:
makeBase(object = CoCoObject);
showModel("all", object = CoCoObject);
makeBase("current", object = CoCoObject);
showModel("all", object = CoCoObject);

# Generate some more models, here by "editModel":
        
# enterModel("ADEF,ABDG.;", object = CoCoObject);
enterModel("ACDE,ABCF.;", object = CoCoObject);
makeBase(object = CoCoObject);

editModel(action = "drop.interactions", modification = "ABDG.;",
          object = CoCoObject);
makeCurrent("last", object = CoCoObject);
showTest(object = CoCoObject);

editModel(action = "drop.edges", modification = "AD,BG.;",
          object = CoCoObject);
makeCurrent("last", object = CoCoObject);
showTest(object = CoCoObject);

# enterModel("ADF,AEF,BD,G.;", object = CoCoObject);
enterModel("ACE,ADE,BC,F.;", object = CoCoObject);
makeCurrent("last", object = CoCoObject);
showTest(object = CoCoObject);

enterModel(".;", object = CoCoObject);

showModel("all", object = CoCoObject);

makeBase(2, object = CoCoObject);
makeCurrent(6, object = CoCoObject);

showModel("all", object = CoCoObject);
        
# Show the first 10 models:
makeCurrent(10, object = CoCoObject)
while(makeCurrent("previous", 
                  object = CoCoObject)) showModel(object = CoCoObject)

# Show the first 10 models:
makeCurrent(10, object = CoCoObject)
while(returnModelNumber("current", object = CoCoObject) < 15) {
         makeCurrent("next", object = CoCoObject); 
         showModel(object = CoCoObject); }

endCoCo(object = CoCoObject);

[Package CoCoRaw version 0.1.7.4 Index]