getHistory {msProcess} | R Documentation |
Extracts a registered event history from an arbitrary object or a specified event within that history.
getHistory(x, event=NULL)
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). |
an object of class msHistory
. If event
is specified, only
that event is returned in the history.
assignEvent
, isProcessRecorded
, existHistory
, eventHistory
.
## 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"]