Delete or Extract a Branch of a Tree
Deletes or extracts a given branch of a tree.
## S3 method for class 'linnet': deletebranch(X, code, labels, \dots)
## S3 method for class 'lpp': deletebranch(X, code, labels, \dots)
## S3 method for class 'linnet': extractbranch(X, code, labels, \dots, which=NULL)
## S3 method for class 'lpp': extractbranch(X, code, labels, \dots, which=NULL)
- Linear network (object of class
"linnet") or point pattern on a linear network (object of class
- Character string. Label of the branch to be deleted or extracted.
- Vector of character strings. Branch labels for the
vertices of the network, usually obtained from
- Arguments passed to methods.
- Logical vector indicating which vertices of the network
should be extracted. Overrides
The linear network
L <- X or
L <- as.linnet(X)
must be a tree, that is, it has no loops.
labels should be a character vector
giving tree branch labels for each vertex of the network.
It is usually obtained by calling
The branch designated by the string
code will be deleted
The return value is the result of deleting or extracting
this branch from
along with any data associated with this branch (such as points or marks).
- Another object of the same type as
Xobtained by deleting or extracting the specified branch.
example(treebranchlabels) LminusB <- deletebranch(L, "b", tb) plot(LminusB, add=TRUE, col="green") LB <- extractbranch(L, "b", tb) plot(LB, add=TRUE, col="red")