зеркало из https://github.com/microsoft/wpa.git
docs: enrich network docs
Add default return values
This commit is contained in:
Родитель
2ff3729d6f
Коммит
d32e9f85fd
|
@ -10,8 +10,10 @@
|
|||
#' this function, you will require all the pre-requisites of the **leiden** package installed,
|
||||
#' which includes Python and **reticulate**.
|
||||
#'
|
||||
#' @param data Data frame containing a Person to Person query.
|
||||
#' @param data Data frame containing a Person to Person Network query. Note that this function is
|
||||
#' computationally intensive and may take a noticeably longer time to process beyond 5000 rows.
|
||||
#' @param hrvar String containing the HR attribute to be matched in the dataset.
|
||||
#' Defaults to "Organization".
|
||||
#' @param bg_fill String to specify background fill colour.
|
||||
#' @param font_col String to specify font and link colour.
|
||||
#' @param node_alpha A numeric value between 0 and 1 to specify the transparency of the nodes.
|
||||
|
@ -28,7 +30,8 @@
|
|||
#' @param res Resolution parameter to be passed to `leiden::leiden()`. Defaults to 0.5.
|
||||
#' @param desc_hrvar Character vector of length 3 containing the HR attributes to use when returning the
|
||||
#' "describe" output. See `network_describe()`.
|
||||
#' @param return String specifying what output to return. Valid return options include:
|
||||
#' @param return String specifying what output to return. Defaults to "plot-leiden".
|
||||
#' Valid return options include:
|
||||
#' - 'plot-leiden': return a network plot coloured by leiden communities, saving a PDF to `path`.
|
||||
#' - 'plot-hrvar': return a network plot coloured by HR attribute, saving a PDF to `path`.
|
||||
#' - 'plot-sankey': return a sankey plot combining communities and HR attribute.
|
||||
|
@ -41,7 +44,7 @@
|
|||
#'
|
||||
#' @export
|
||||
network_leiden <- function(data,
|
||||
hrvar,
|
||||
hrvar = "Organization",
|
||||
bg_fill = "#000000",
|
||||
font_col = "#FFFFFF",
|
||||
algorithm = "mds",
|
||||
|
@ -49,7 +52,7 @@ network_leiden <- function(data,
|
|||
node_alpha = 0.8,
|
||||
res = 0.5,
|
||||
desc_hrvar = c("Organization", "LevelDesignation", "FunctionType"),
|
||||
return){
|
||||
return = "plot-leiden"){
|
||||
|
||||
## Set variables
|
||||
TO_hrvar <- paste0("TieOrigin_", hrvar)
|
||||
|
|
|
@ -9,8 +9,10 @@
|
|||
#' Take a P2P network query and implement the Louvain community detection method. The
|
||||
#' **igraph** implementation of the Louvain method is used.
|
||||
#'
|
||||
#' @param data Data frame containing a Person to Person query.
|
||||
#' @param data Data frame containing a Person to Person Network query. Note that this function is
|
||||
#' computationally intensive and may take a noticeably longer time to process beyond 5000 rows.
|
||||
#' @param hrvar String containing the HR attribute to be matched in the dataset.
|
||||
#' Defaults to "Organization".
|
||||
#' @param bg_fill String to specify background fill colour.
|
||||
#' @param font_col String to specify font and link colour.
|
||||
#' @param node_alpha A numeric value between 0 and 1 to specify the transparency of the nodes.
|
||||
|
@ -25,7 +27,8 @@
|
|||
#' @param desc_hrvar Character vector of length 3 containing the HR attributes to use when returning the
|
||||
#' "describe" output. See `network_describe()`.
|
||||
#'
|
||||
#' @param return String specifying what output to return.Valid return options include:
|
||||
#' @param return String specifying what output to return. Defaults to "plot-louvain".
|
||||
#' Valid return options include:
|
||||
#' - 'plot-louvain': return a network plot coloured by louvain communities, saving a PDF to `path`.
|
||||
#' - 'plot-hrvar': return a network plot coloured by HR attribute, saving a PDF to `path`.
|
||||
#' - 'plot-sankey': return a sankey plot combining communities and HR attribute.
|
||||
|
@ -39,14 +42,14 @@
|
|||
#'
|
||||
#' @export
|
||||
network_louvain <- function(data,
|
||||
hrvar,
|
||||
hrvar = "Organization",
|
||||
bg_fill = "#000000",
|
||||
font_col = "#FFFFFF",
|
||||
node_alpha = 0.8,
|
||||
algorithm = "mds",
|
||||
path = "network_p2p_louvain",
|
||||
desc_hrvar = c("Organization", "LevelDesignation", "FunctionType"),
|
||||
return){
|
||||
return = "plot-louvain"){
|
||||
|
||||
## Set variables
|
||||
TO_hrvar <- paste0("TieOrigin_", hrvar)
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
\usage{
|
||||
network_leiden(
|
||||
data,
|
||||
hrvar,
|
||||
hrvar = "Organization",
|
||||
bg_fill = "#000000",
|
||||
font_col = "#FFFFFF",
|
||||
algorithm = "mds",
|
||||
|
@ -14,13 +14,15 @@ network_leiden(
|
|||
node_alpha = 0.8,
|
||||
res = 0.5,
|
||||
desc_hrvar = c("Organization", "LevelDesignation", "FunctionType"),
|
||||
return
|
||||
return = "plot-leiden"
|
||||
)
|
||||
}
|
||||
\arguments{
|
||||
\item{data}{Data frame containing a Person to Person query.}
|
||||
\item{data}{Data frame containing a Person to Person Network query. Note that this function is
|
||||
computationally intensive and may take a noticeably longer time to process beyond 5000 rows.}
|
||||
|
||||
\item{hrvar}{String containing the HR attribute to be matched in the dataset.}
|
||||
\item{hrvar}{String containing the HR attribute to be matched in the dataset.
|
||||
Defaults to "Organization".}
|
||||
|
||||
\item{bg_fill}{String to specify background fill colour.}
|
||||
|
||||
|
@ -43,7 +45,8 @@ if returning anything other than "plot-leiden" or "plot-hrvar".}
|
|||
\item{desc_hrvar}{Character vector of length 3 containing the HR attributes to use when returning the
|
||||
"describe" output. See \code{network_describe()}.}
|
||||
|
||||
\item{return}{String specifying what output to return. Valid return options include:
|
||||
\item{return}{String specifying what output to return. Defaults to "plot-leiden".
|
||||
Valid return options include:
|
||||
\itemize{
|
||||
\item 'plot-leiden': return a network plot coloured by leiden communities, saving a PDF to \code{path}.
|
||||
\item 'plot-hrvar': return a network plot coloured by HR attribute, saving a PDF to \code{path}.
|
||||
|
|
|
@ -6,20 +6,22 @@
|
|||
\usage{
|
||||
network_louvain(
|
||||
data,
|
||||
hrvar,
|
||||
hrvar = "Organization",
|
||||
bg_fill = "#000000",
|
||||
font_col = "#FFFFFF",
|
||||
node_alpha = 0.8,
|
||||
algorithm = "mds",
|
||||
path = "network_p2p_louvain",
|
||||
desc_hrvar = c("Organization", "LevelDesignation", "FunctionType"),
|
||||
return
|
||||
return = "plot-louvain"
|
||||
)
|
||||
}
|
||||
\arguments{
|
||||
\item{data}{Data frame containing a Person to Person query.}
|
||||
\item{data}{Data frame containing a Person to Person Network query. Note that this function is
|
||||
computationally intensive and may take a noticeably longer time to process beyond 5000 rows.}
|
||||
|
||||
\item{hrvar}{String containing the HR attribute to be matched in the dataset.}
|
||||
\item{hrvar}{String containing the HR attribute to be matched in the dataset.
|
||||
Defaults to "Organization".}
|
||||
|
||||
\item{bg_fill}{String to specify background fill colour.}
|
||||
|
||||
|
@ -40,7 +42,8 @@ if returning anything other than "plot-louvain" or "plot-hrvar".}
|
|||
\item{desc_hrvar}{Character vector of length 3 containing the HR attributes to use when returning the
|
||||
"describe" output. See \code{network_describe()}.}
|
||||
|
||||
\item{return}{String specifying what output to return.Valid return options include:
|
||||
\item{return}{String specifying what output to return. Defaults to "plot-louvain".
|
||||
Valid return options include:
|
||||
\itemize{
|
||||
\item 'plot-louvain': return a network plot coloured by louvain communities, saving a PDF to \code{path}.
|
||||
\item 'plot-hrvar': return a network plot coloured by HR attribute, saving a PDF to \code{path}.
|
||||
|
|
Загрузка…
Ссылка в новой задаче