Skip to content

Commit

Permalink
edits
Browse files Browse the repository at this point in the history
  • Loading branch information
fmichonneau committed Jan 23, 2024
1 parent c3c179f commit 0fa1115
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 38 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export(nData)
export(nEdges)
export(nNodes)
export(nTips)
export(names)
export(nodeData)
export(nodeDepth)
export(nodeHeight)
Expand Down
69 changes: 34 additions & 35 deletions R/addData-methods.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

##' Adding data to a phylo4 or a phylo4d object
##'
##' \code{addData} adds data to a \code{phylo4} (converting it in a
Expand All @@ -14,41 +13,41 @@
##' The option \code{pos} is ignored (silently) if \code{x} is a
##' \code{phylo4} object. It is provided for compatibility reasons.
##'
##' @param x a phylo4 or a phylo4d object
##' @param tip.data a data frame (or object to be coerced to one)
##' containing only tip data
##' @param node.data a data frame (or object to be coerced to one)
##' containing only node data
##' @param all.data a data frame (or object to be coerced to one)
##' containing both tip and node data
##' @param merge.data if both \code{tip.data} and \code{node.data} are
##' provided, it determines whether columns with common names will be
##' merged together (default TRUE). If FALSE, columns with common
##' names will be preserved separately, with ".tip" and ".node"
##' appended to the names. This argument has no effect if
##' \code{tip.data} and \code{node.data} have no column names in
##' common.
##' @param pos should the new data provided be bound \code{before} or
##' \code{after} the pre-existing data?
##' @param \dots additional arguments to control how matching between
##' data and tree (see Details section of
##' \code{\link{phylo4d-methods}} for more details).
##' @return \code{addData} returns a \code{phylo4d} object.
##' @author Francois Michonneau
##' @seealso \code{\link{tdata}} for extracting or updating data and
##' \code{\link{phylo4d-methods}} constructor.
##' @keywords methods
##' @rdname addData-methods
##' @include phylo4d-class.R
##' @export
##' @examples
##' data(geospiza)
##' nDt <- data.frame(a=rnorm(nNodes(geospiza)), b=1:nNodes(geospiza),
##' row.names=nodeId(geospiza, "internal"))
##' t1 <- addData(geospiza, node.data=nDt)
setGeneric("addData", function(x, ...) {
##' @param x a phylo4 or a phylo4d object
##' @param tip.data a data frame (or object to be coerced to one)
##' containing only tip data
##' @param node.data a data frame (or object to be coerced to one)
##' containing only node data
##' @param all.data a data frame (or object to be coerced to one)
##' containing both tip and node data
##' @param merge.data if both \code{tip.data} and \code{node.data} are
##' provided, it determines whether columns with common names will be
##' merged together (default TRUE). If FALSE, columns with common
##' names will be preserved separately, with ".tip" and ".node"
##' appended to the names. This argument has no effect if
##' \code{tip.data} and \code{node.data} have no column names in
##' common.
##' @param pos should the new data provided be bound \code{before} or
##' \code{after} the pre-existing data?
##' @param \dots additional arguments to control how matching between
##' data and tree (see Details section of
##' \code{\link{phylo4d-methods}} for more details).
##' @return \code{addData} returns a \code{phylo4d} object.
##' @author Francois Michonneau
##' @seealso \code{\link{tdata}} for extracting or updating data and
##' \code{\link{phylo4d-methods}} constructor.
##' @keywords methods
##' @rdname addData-methods
##' @include phylo4d-class.R
##' @export
##' @examples
##' data(geospiza)
##' nDt <- data.frame(a=rnorm(nNodes(geospiza)), b=1:nNodes(geospiza),
##' row.names=nodeId(geospiza, "internal"))
##' t1 <- addData(geospiza, node.data=nDt)
setGeneric("addData", function(x, ...) {
standardGeneric("addData")
})
})

##' @rdname addData-methods
##' @aliases addData-methods addData,phylo4-method
Expand Down
2 changes: 1 addition & 1 deletion R/phylo4d-methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
##' @details This is the list of additional arguments that can be used
##' to control matching between the tree and the data:
##'
##' \itemize{
##' \describe{
##'
##' \item{match.data}{(logical) should the rownames of the data frame
##' be used to be matched against tip and internal node identifiers?}
Expand Down
1 change: 1 addition & 0 deletions R/print-methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ setMethod("show", signature(object="phylo4"),
##' @rdname print-methods
##' @aliases names
##' @exportMethod names
##' @export
setGeneric("names")

##' @rdname print-methods
Expand Down
2 changes: 1 addition & 1 deletion man/phylo4d-methods.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/subset-methods.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 0fa1115

Please sign in to comment.