getHistory {msProcess}R Documentation

Extract an Event History from an Arbitrary Object

Description

Extracts a registered event history from an arbitrary object or a specified event within that history.

Usage

getHistory(x, event=NULL)

Arguments

x an object of any class.
event a character string or integer defining a specific event to query. If no such event has been registered in a history object (or the history object does not exist) then a NA is returned. Default: NULL (do not extract a specific event).

Value

an object of class msHistory. If event is specified, only that event is returned in the history.

See Also

assignEvent, isProcessRecorded, existHistory, eventHistory.

Examples

## create a simple history 
z <- 1:5
z <- eventHistory(z, "Event A"=list(number="first", positive="yes"),
    "Event B"=list(horse="mustang"),
    "Event C"=list(string="violins and cellos", percussion="drums",
       reed="flutes and oboes"))

## extract the entire event history 
getHistory(z)

## extract only Event B (each method is 
## equivalent) 
getHistory(z,"Event B")
getHistory(z,2)
getHistory(z)["Event B"]
getHistory(z)[2]

## return entire history except the second event 
## (each method is equivalent) 
getHistory(z,-2)
getHistory(z)[-2]

## attempt to extract a non-existent event (NA is 
## returned) 
getHistory(z)["dogs"]

[Package msProcess version 1.0.5 Index]