select.origins {ArvoRe} | R Documentation |
~~ A concise (1-5 lines) description of what the function does. ~~
select.origins(TheTree, node.col, node.number)
TheTree |
~~Describe TheTree here~~ |
node.col |
~~Describe node.col here~~ |
node.number |
~~Describe node.number here~~ |
~~ If necessary, more details than the description above ~~
~Describe the value returned If it is a LIST, use
comp1 |
Description of 'comp1' |
comp2 |
Description of 'comp2' |
...
....
~~further notes~~
~Make other sections like Warning with section{Warning }{....} ~
~~who you are~~
~put references to the literature/web site here ~
~~objects to See Also as help
, ~~~
##---- 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) }