select.origins {ArvoRe}R Documentation

~~function to do ... ~~

Description

~~ A concise (1-5 lines) description of what the function does. ~~

Usage

select.origins(TheTree, node.col, node.number)

Arguments

TheTree ~~Describe TheTree here~~
node.col ~~Describe node.col here~~
node.number ~~Describe node.number here~~

Details

~~ If necessary, more details than the description above ~~

Value

~Describe the value returned If it is a LIST, use

comp1 Description of 'comp1'
comp2 Description of 'comp2'

...

Warning

....

Note

~~further notes~~

~Make other sections like Warning with section{Warning }{....} ~

Author(s)

~~who you are~~

References

~put references to the literature/web site here ~

See Also

~~objects to See Also as help, ~~~

Examples

##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--    or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function(TheTree, node.col, node.number) {
        require(abind)
        position <- intersect(which((TheTree$Level == node.col)),which(TheTree$Node.N == node.number))
        ans <- TheTree[position,]
        
        levelnodevalue <- node.col - 1
        nodenumbervalue <- ans$Father[1] #[position]
        
        while ( levelnodevalue > 0) {
                position <- intersect(which((TheTree$Level == levelnodevalue)),which(TheTree$Node.N == nodenumbervalue))
                subData <- TheTree[position,]
                ans <- abind(subData, ans, along=1)
                nodenumbervalue <- subData$Father[1]
                levelnodevalue <- levelnodevalue - 1
        }
        ans <- as.data.frame(ans)
        
        ans$Level <- as.numeric(ans$Level)
        ans$Node.N <- as.numeric(ans$Node.N)
        ans$Node.name <- as.character(ans$Node.name)
        ans$Father <- as.numeric(ans$Father)
        ans$Father.Name <- as.character(ans$Father.Name)
        ans$Prob <- as.numeric(ans$Prob)
        ans$Type <- as.character(ans$Type)
        ans$Note <- as.character(ans$Note)
        ans$Destiny <- as.character(ans$Destiny)
        ans$Payoff1 <- as.numeric(as.character(ans$Payoff1))
        ans$Payoff2 <- as.numeric(as.character(ans$Payoff2))

        return(ans)
  }

[Package ArvoRe version 0.1.6 Index]