From 0229933bc1673791b5c0dd61ad4721d8d8125648 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20G=C3=A4rber?= <florian.gaerber@uni-hamburg.de> Date: Mon, 25 Sep 2023 11:57:58 +0200 Subject: [PATCH] doc: Fix mixed use of Rd and Md doc blocks --- DESCRIPTION | 1 - R/addLayer.R | 2 ++ R/addSurrogates.R | 5 +++++ R/getTreeranger.R | 2 ++ man/var.relations.Rd | 4 ++-- man/var.relations.mfi.Rd | 4 ++-- man/var.select.md.Rd | 6 +++--- man/var.select.mir.Rd | 6 +++--- man/var.select.smd.Rd | 10 +++++----- 9 files changed, 24 insertions(+), 16 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 53a808b..5b2267a 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -36,5 +36,4 @@ LinkingTo: Config/testthat/edition: 3 Encoding: UTF-8 LazyData: true -Roxygen: list(markdown = TRUE) RoxygenNote: 7.2.3 diff --git a/R/addLayer.R b/R/addLayer.R index 03b7065..78c91c4 100644 --- a/R/addLayer.R +++ b/R/addLayer.R @@ -18,6 +18,7 @@ #' * `layer`: Tree layer depth information, starting at 0 (root node) and incremented for each layer. #' #' @export +#' @md addLayer <- function(trees, num.threads = 1) { if (!inherits(trees, "RangerTrees")) { stop("`trees` must be a `getTreeranger` `RangerTrees` object.") @@ -42,6 +43,7 @@ addLayer <- function(trees, num.threads = 1) { #' @seealso [addLayer()] #' #' @keywords internal +#' @md add_layer_to_tree <- function(tree) { layer <- rep(NA, nrow(tree)) layer[1] <- 0 diff --git a/R/addSurrogates.R b/R/addSurrogates.R index bea7a07..a95ef5e 100644 --- a/R/addSurrogates.R +++ b/R/addSurrogates.R @@ -21,6 +21,7 @@ #' * `adj_i`: adjusted agreement of variable i #' #' @export +#' @md addSurrogates <- function(RF, trees, s, Xdata, num.threads = parallel::detectCores()) { if (!inherits(RF, "ranger")) { stop("`RF` must be a ranger object.") @@ -69,6 +70,7 @@ addSurrogates <- function(RF, trees, s, Xdata, num.threads = parallel::detectCor #' This is an internal function #' #' @keywords internal +#' @md getSurrogate <- function(surr.par, k = 1, maxsurr) { # weights and trees are extracted tree <- surr.par$trees[[k]] @@ -92,6 +94,7 @@ getSurrogate <- function(surr.par, k = 1, maxsurr) { #' @useDynLib RFSurrogates, .registration = TRUE #' #' @keywords internal +#' @md SurrTree <- function(j, wt, Xdata, controls, column.names, tree, maxsurr, ncat) { node <- tree[j, ] # for non-terminal nodes get surrogates @@ -145,6 +148,7 @@ SurrTree <- function(j, wt, Xdata, controls, column.names, tree, maxsurr, ncat) #' This is an internal function #' #' @keywords internal +#' @md name.surr <- function(i, surrogate.names) { surrogate.names <- c(surrogate.names, paste0("surrogate_", i)) return(surrogate.names) @@ -155,6 +159,7 @@ name.surr <- function(i, surrogate.names) { #' This is an internal function #' #' @keywords internal +#' @md name.adj <- function(i, adj.names) { adj.names <- c(adj.names, paste0("adj_", i)) return(adj.names) diff --git a/R/getTreeranger.R b/R/getTreeranger.R index 5dc21dd..5f5dffd 100644 --- a/R/getTreeranger.R +++ b/R/getTreeranger.R @@ -19,6 +19,7 @@ #' * `layer`: If `add_layer` is `TRUE`, see [addLayer()] #' #' @export +#' @md getTreeranger <- function(RF, num.trees = RF$num.trees, add_layer = FALSE, num.threads = 1) { trees <- parallel::mclapply(1:num.trees, getsingletree, mc.cores = num.threads, @@ -53,6 +54,7 @@ getTreeranger <- function(RF, num.trees = RF$num.trees, add_layer = FALSE, num.t #' * `status`: `0` for terminal (`splitpoint` is `NA`) and `1` for non-terminal. #' #' @keywords internal +#' @md getsingletree <- function(RF, k = 1, add_layer = FALSE) { # here we use the treeInfo function of the ranger package to create extract the trees, in an earlier version this was done with a self implemented function tree.ranger <- ranger::treeInfo(RF, tree = k) diff --git a/man/var.relations.Rd b/man/var.relations.Rd index cae2c0b..9e700f5 100644 --- a/man/var.relations.Rd +++ b/man/var.relations.Rd @@ -36,7 +36,7 @@ classification mode is used). For survival forests this is the time variable.} \item{type}{mode of prediction ("regression", "classification" or "survival"). Default is regression.} -\item{s}{predefined number of surrogate splits (it may happen that the actual number of surrogate splits differs in individual nodes). Default is 1 \\% of no. of variables.} +\item{s}{predefined number of surrogate splits (it may happen that the actual number of surrogate splits differs in individual nodes). Default is 1 \% of no. of variables.} \item{mtry}{number of variables to possibly split at in each node. Default is no. of variables^(3/4) ("^3/4") as recommended by (Ishwaran 2011). Also possible is "sqrt" and "0.5" to use the square root or half of the no. of variables.} @@ -48,7 +48,7 @@ classification mode is used). For survival forests this is the time variable.} \item{save.ranger}{set TRUE if ranger object should be saved. Default is that ranger object is not saved (FALSE).} -\item{create.forest}{Default: TRUE if \code{forest} is NULL, FALSE otherwise. Whether to create or use an existing forest.} +\item{create.forest}{Default: TRUE if `forest` is NULL, FALSE otherwise. Whether to create or use an existing forest.} \item{forest}{the random forest that should be analyzed} diff --git a/man/var.relations.mfi.Rd b/man/var.relations.mfi.Rd index 42dd9b5..0128835 100644 --- a/man/var.relations.mfi.Rd +++ b/man/var.relations.mfi.Rd @@ -37,7 +37,7 @@ classification mode is used). For survival forests this is the time variable.} \item{type}{mode of prediction ("regression", "classification" or "survival"). Default is regression.} -\item{s}{predefined number of surrogate splits (it may happen that the actual number of surrogate splits differs in individual nodes). Default is 1 \\% of no. of variables.} +\item{s}{predefined number of surrogate splits (it may happen that the actual number of surrogate splits differs in individual nodes). Default is 1 \% of no. of variables.} \item{mtry}{number of variables to possibly split at in each node. Default is no. of variables^(3/4) ("^3/4") as recommended by (Ishwaran 2011). Also possible is "sqrt" and "0.5" to use the square root or half of the no. of variables.} @@ -49,7 +49,7 @@ classification mode is used). For survival forests this is the time variable.} \item{save.ranger}{set TRUE if ranger object should be saved. Default is that ranger object is not saved (FALSE).} -\item{create.forest}{Default: TRUE if \code{forest} is NULL, FALSE otherwise. Whether to create or use an existing forest.} +\item{create.forest}{Default: TRUE if `forest` is NULL, FALSE otherwise. Whether to create or use an existing forest.} \item{forest}{the random forest that should be analyzed} diff --git a/man/var.select.md.Rd b/man/var.select.md.Rd index 42ae1a1..15d6a9d 100644 --- a/man/var.select.md.Rd +++ b/man/var.select.md.Rd @@ -41,7 +41,7 @@ classification mode is used). For survival forests this is the time variable.} \item{save.ranger}{Set TRUE if ranger object should be saved. Default is that ranger object is not saved (FALSE).} -\item{create.forest}{Default: TRUE if \code{forest} is NULL, FALSE otherwise. Whether to create or use an existing forest.} +\item{create.forest}{Default: TRUE if `forest` is NULL, FALSE otherwise. Whether to create or use an existing forest.} \item{forest}{the random forest that should be analyzed.} @@ -90,7 +90,7 @@ res$var } \references{ \itemize{ -\item Ishwaran, H. et al. (2011) Random survival forests for high-dimensional data. Stat Anal Data Min, 4, 115–132. \url{https://onlinelibrary.wiley.com/doi/abs/10.1002/sam.10103} -\item Ishwaran, H. et al. (2010) High-Dimensional Variable Selection for Survival Data. J. Am. Stat. Assoc., 105, 205–217. \url{http://www.ccs.miami.edu/~hishwaran/papers/IKGML.JASA.2010.pdf} + \item Ishwaran, H. et al. (2011) Random survival forests for high-dimensional data. Stat Anal Data Min, 4, 115–132. \url{https://onlinelibrary.wiley.com/doi/abs/10.1002/sam.10103} + \item Ishwaran, H. et al. (2010) High-Dimensional Variable Selection for Survival Data. J. Am. Stat. Assoc., 105, 205–217. \url{http://www.ccs.miami.edu/~hishwaran/papers/IKGML.JASA.2010.pdf} } } diff --git a/man/var.select.mir.Rd b/man/var.select.mir.Rd index 90cc19f..aa42325 100644 --- a/man/var.select.mir.Rd +++ b/man/var.select.mir.Rd @@ -40,7 +40,7 @@ classification mode is used). For survival forests this is the time variable.} \item{type}{mode of prediction ("regression", "classification" or "survival"). Default is regression.} -\item{s}{predefined number of surrogate splits (it may happen that the actual number of surrogate splits differs in individual nodes). Default is 1 \\% of no. of variables.} +\item{s}{predefined number of surrogate splits (it may happen that the actual number of surrogate splits differs in individual nodes). Default is 1 \% of no. of variables.} \item{mtry}{number of variables to possibly split at in each node. Default is no. of variables^(3/4) ("^3/4") as recommended by (Ishwaran 2011). Also possible is "sqrt" and "0.5" to use the square root or half of the no. of variables.} @@ -112,7 +112,7 @@ res$var } \references{ \itemize{ -\item Nembrini, S. et al. (2018) The revival of the Gini importance? Bioinformatics, 34, 3711–3718. \url{https://academic.oup.com/bioinformatics/article/34/21/3711/4994791} -\item Seifert, S. et al. (2019) Surrogate minimal depth as an importance measure for variables in random forests. Bioinformatics, 35, 3663–3671. \url{https://academic.oup.com/bioinformatics/article/35/19/3663/5368013} + \item Nembrini, S. et al. (2018) The revival of the Gini importance? Bioinformatics, 34, 3711–3718. \url{https://academic.oup.com/bioinformatics/article/34/21/3711/4994791} + \item Seifert, S. et al. (2019) Surrogate minimal depth as an importance measure for variables in random forests. Bioinformatics, 35, 3663–3671. \url{https://academic.oup.com/bioinformatics/article/35/19/3663/5368013} } } diff --git a/man/var.select.smd.Rd b/man/var.select.smd.Rd index d596496..062095a 100644 --- a/man/var.select.smd.Rd +++ b/man/var.select.smd.Rd @@ -32,7 +32,7 @@ classification mode is used). For survival forests this is the time variable.} \item{type}{mode of prediction ("regression", "classification" or "survival"). Default is regression.} -\item{s}{predefined number of surrogate splits (it may happen that the actual number of surrogate splits differs in individual nodes). Default is 1 \\% of no. of variables.} +\item{s}{predefined number of surrogate splits (it may happen that the actual number of surrogate splits differs in individual nodes). Default is 1 \% of no. of variables.} \item{mtry}{number of variables to possibly split at in each node. Default is no. of variables^(3/4) ("^3/4") as recommended by (Ishwaran 2011). Also possible is "sqrt" and "0.5" to use the square root or half of the no. of variables.} @@ -44,7 +44,7 @@ classification mode is used). For survival forests this is the time variable.} \item{save.ranger}{set TRUE if ranger object should be saved. Default is that ranger object is not saved (FALSE).} -\item{create.forest}{Default: TRUE if \code{forest} is NULL, FALSE otherwise. Whether to create or use an existing forest.} +\item{create.forest}{Default: TRUE if `forest` is NULL, FALSE otherwise. Whether to create or use an existing forest.} \item{forest}{the random forest that should be analyzed} @@ -96,8 +96,8 @@ res$var } \references{ \itemize{ -\item Seifert, S. et al. (2019) Surrogate minimal depth as an importance measure for variables in random forests. Bioinformatics, 35, 3663–3671. \url{https://academic.oup.com/bioinformatics/article/35/19/3663/5368013} -\item Ishwaran, H. et al. (2011) Random survival forests for high-dimensional data. Stat Anal Data Min, 4, 115–132. \url{https://onlinelibrary.wiley.com/doi/abs/10.1002/sam.10103} -\item Ishwaran, H. et al. (2010) High-Dimensional Variable Selection for Survival Data. J. Am. Stat. Assoc., 105, 205–217. \url{http://www.ccs.miami.edu/~hishwaran/papers/IKGML.JASA.2010.pdf} + \item Seifert, S. et al. (2019) Surrogate minimal depth as an importance measure for variables in random forests. Bioinformatics, 35, 3663–3671. \url{https://academic.oup.com/bioinformatics/article/35/19/3663/5368013} + \item Ishwaran, H. et al. (2011) Random survival forests for high-dimensional data. Stat Anal Data Min, 4, 115–132. \url{https://onlinelibrary.wiley.com/doi/abs/10.1002/sam.10103} + \item Ishwaran, H. et al. (2010) High-Dimensional Variable Selection for Survival Data. J. Am. Stat. Assoc., 105, 205–217. \url{http://www.ccs.miami.edu/~hishwaran/papers/IKGML.JASA.2010.pdf} } } -- GitLab